Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Unify the way how unit tests are conditionally skipped #752

Copy link
Copy link

Description

@plamut
Issue body actions

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.parse_version("1.0.0")

if pandas is not None:
    PANDAS_INSTALLED_VERSION = pkg_resources.get_distribution("pandas").parsed_version
else:
    # Set to less than MIN version.
    PANDAS_INSTALLED_VERSION = pkg_resources.parse_version("0.0.0")

...

@unittest.skipIf( 
    pandas is None or PANDAS_INSTALLED_VERSION < PANDAS_MINIUM_VERSION, 
    "Only `pandas version >=1.0.0` supported", 
) 

The alternative approach is using pytest.importorskip, which is more concise:

pytest.importorskip(
        "pandas",
        minversion="1.0.0",
        reason="Requires `pandas version >= 1.0.0` which introduces pandas.NA",
)

We 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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.Issues related to the googleapis/python-bigquery API.priority: p3Desirable enhancement or fix. May not be included in next release.Desirable enhancement or fix. May not be included in next release.testingtype: cleanupAn internal cleanup or hygiene concern.An internal cleanup or hygiene concern.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.