Skip to content

Commit 087c2f1

Browse files
gfyoungjreback
authored andcommitted
TST: Replace check_package with skip_if_no_package (#15709)
check_package literally just called skip_if_no_package with no additional decorations.
1 parent d313808 commit 087c2f1

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

pandas/tests/io/test_pytables.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,8 @@ def test_put_compression(self):
728728
format='fixed', complib='zlib')
729729

730730
def test_put_compression_blosc(self):
731-
tm.skip_if_no_package('tables', '2.2', app='blosc support')
731+
tm.skip_if_no_package('tables', min_version='2.2',
732+
app='blosc support')
732733
if skip_compression:
733734
pytest.skip("skipping on windows/PY3")
734735

pandas/util/testing.py

+10-17
Original file line numberDiff line numberDiff line change
@@ -2010,12 +2010,16 @@ def __init__(self, *args, **kwargs):
20102010
dict.__init__(self, *args, **kwargs)
20112011

20122012

2013-
# Dependency checks. Copied this from Nipy/Nipype (Copyright of
2014-
# respective developers, license: BSD-3)
2015-
def package_check(pkg_name, min_version=None, max_version=None, app='pandas',
2016-
checker=LooseVersion):
2013+
# Dependency checker when running tests.
2014+
#
2015+
# Copied this from nipy/nipype
2016+
# Copyright of respective developers, License: BSD-3
2017+
def skip_if_no_package(pkg_name, min_version=None, max_version=None,
2018+
app='pandas', checker=LooseVersion):
20172019
"""Check that the min/max version of the required package is installed.
20182020
2021+
If the package check fails, the test is automatically skipped.
2022+
20192023
Parameters
20202024
----------
20212025
pkg_name : string
@@ -2025,11 +2029,11 @@ def package_check(pkg_name, min_version=None, max_version=None, app='pandas',
20252029
max_version : string, optional
20262030
Max version number for required package.
20272031
app : string, optional
2028-
Application that is performing the check. For instance, the
2032+
Application that is performing the check. For instance, the
20292033
name of the tutorial being executed that depends on specific
20302034
packages.
20312035
checker : object, optional
2032-
The class that will perform the version checking. Default is
2036+
The class that will perform the version checking. Default is
20332037
distutils.version.LooseVersion.
20342038
20352039
Examples
@@ -2061,17 +2065,6 @@ def package_check(pkg_name, min_version=None, max_version=None, app='pandas',
20612065
pytest.skip(msg)
20622066

20632067

2064-
def skip_if_no_package(*args, **kwargs):
2065-
"""pytest.skip() if package_check fails
2066-
2067-
Parameters
2068-
----------
2069-
*args Positional parameters passed to `package_check`
2070-
*kwargs Keyword parameters passed to `package_check`
2071-
"""
2072-
package_check(*args, **kwargs)
2073-
2074-
20752068
def optional_args(decorator):
20762069
"""allows a decorator to take optional positional and keyword arguments.
20772070
Assumes that taking a single, callable, positional argument means that

0 commit comments

Comments
 (0)