Title: Unify the way how unit tests are conditionally skipped · Issue #752 · googleapis/python-bigquery · GitHub
Open Graph Title: Unify the way how unit tests are conditionally skipped · Issue #752 · googleapis/python-bigquery
X Title: Unify the way how unit tests are conditionally skipped · Issue #752 · googleapis/python-bigquery
Description: Following the comment, we currently use two different ways of conditionally skipping unit tests that require particular minimum dependency version. One approach parses the installed version manually: PANDAS_MINIUM_VERSION = pkg_resources...
Open Graph Description: Following the comment, we currently use two different ways of conditionally skipping unit tests that require particular minimum dependency version. One approach parses the installed version manuall...
X Description: Following the comment, we currently use two different ways of conditionally skipping unit tests that require particular minimum dependency version. One approach parses the installed version manuall...
Opengraph URL: https://github.com/googleapis/python-bigquery/issues/752
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unify the way how unit tests are conditionally skipped","articleBody":"Following the [comment](https://github.com/googleapis/python-bigquery/pull/750#discussion_r667878253), we currently use two different ways of conditionally skipping unit tests that require particular minimum dependency version.\r\n\r\nOne approach parses the installed version manually:\r\n```py\r\nPANDAS_MINIUM_VERSION = pkg_resources.parse_version(\"1.0.0\")\r\n\r\nif pandas is not None:\r\n PANDAS_INSTALLED_VERSION = pkg_resources.get_distribution(\"pandas\").parsed_version\r\nelse:\r\n # Set to less than MIN version.\r\n PANDAS_INSTALLED_VERSION = pkg_resources.parse_version(\"0.0.0\")\r\n\r\n...\r\n\r\n@unittest.skipIf( \r\n pandas is None or PANDAS_INSTALLED_VERSION \u003c PANDAS_MINIUM_VERSION, \r\n \"Only `pandas version \u003e=1.0.0` supported\", \r\n) \r\n```\r\n\r\nThe alternative approach is using `pytest.importorskip`, which is more concise:\r\n```py\r\npytest.importorskip(\r\n \"pandas\",\r\n minversion=\"1.0.0\",\r\n reason=\"Requires `pandas version \u003e= 1.0.0` which introduces pandas.NA\",\r\n)\r\n```\r\n\r\nWe should use `pytest.importorskip` combined with the `minversion` argument. That feature relies on the imported module's `__version__` attribute, but all our major dependencies support it, so we should be fine.","author":{"url":"https://github.com/plamut","@type":"Person","name":"plamut"},"datePublished":"2021-07-12T12:39:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/752/python-bigquery/issues/752"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0034bd7a-5016-56eb-38f6-d290fad7aeaa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B704:8CA80:6D5EEA:99B33B:6A4E785F |
| html-safe-nonce | 82d3069fb5a85d81b6b12adce35440553faabef5df7df2f274a1454cffadbeb4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzA0OjhDQTgwOjZENUVFQTo5OUIzM0I6NkE0RTc4NUYiLCJ2aXNpdG9yX2lkIjoiNDIyODY4NTI5MjI5NzQxODg0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bfad5ed481dfc2262ccd30951d34c9463f4f108f258db41a9c43a38364e959d6 |
| hovercard-subject-tag | issue:942019541 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-bigquery/752/issue_layout |
| twitter:image | https://opengraph.githubassets.com/51b27fdf99babf9632865d2fbd3b4d7dca72723434b4486a3b5915ecd3958dc2/googleapis/python-bigquery/issues/752 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/51b27fdf99babf9632865d2fbd3b4d7dca72723434b4486a3b5915ecd3958dc2/googleapis/python-bigquery/issues/752 |
| og:image:alt | Following the comment, we currently use two different ways of conditionally skipping unit tests that require particular minimum dependency version. One approach parses the installed version manuall... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | plamut |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/python-bigquery git https://github.com/googleapis/python-bigquery.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 226992475 |
| octolytics-dimension-repository_nwo | googleapis/python-bigquery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 226992475 |
| octolytics-dimension-repository_network_root_nwo | googleapis/python-bigquery |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e6a744804e8e70f97b4d5a18a94dcc63db22f97a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width