You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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")
ifpandasisnotNone:
PANDAS_INSTALLED_VERSION=pkg_resources.get_distribution("pandas").parsed_versionelse:
# Set to less than MIN version.PANDAS_INSTALLED_VERSION=pkg_resources.parse_version("0.0.0")
...
@unittest.skipIf( pandasisNoneorPANDAS_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.
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:
The alternative approach is using
pytest.importorskip, which is more concise:We should use
pytest.importorskipcombined with theminversionargument. That feature relies on the imported module's__version__attribute, but all our major dependencies support it, so we should be fine.