From c6280186db0590202eae9ed6d66f06ef067595e6 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Thu, 16 Mar 2017 17:44:35 -0400 Subject: [PATCH] TST: Replace check_package with skip_if_no_package check_package literally just called skip_if_no_package with no additional decorations. --- pandas/tests/io/test_pytables.py | 3 ++- pandas/util/testing.py | 27 ++++++++++----------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 5592c564e51df..8ea8088a297b8 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -728,7 +728,8 @@ def test_put_compression(self): format='fixed', complib='zlib') def test_put_compression_blosc(self): - tm.skip_if_no_package('tables', '2.2', app='blosc support') + tm.skip_if_no_package('tables', min_version='2.2', + app='blosc support') if skip_compression: pytest.skip("skipping on windows/PY3") diff --git a/pandas/util/testing.py b/pandas/util/testing.py index 529ecef3e2d6a..154476ce8340a 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -2010,12 +2010,16 @@ def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) -# Dependency checks. Copied this from Nipy/Nipype (Copyright of -# respective developers, license: BSD-3) -def package_check(pkg_name, min_version=None, max_version=None, app='pandas', - checker=LooseVersion): +# Dependency checker when running tests. +# +# Copied this from nipy/nipype +# Copyright of respective developers, License: BSD-3 +def skip_if_no_package(pkg_name, min_version=None, max_version=None, + app='pandas', checker=LooseVersion): """Check that the min/max version of the required package is installed. + If the package check fails, the test is automatically skipped. + Parameters ---------- pkg_name : string @@ -2025,11 +2029,11 @@ def package_check(pkg_name, min_version=None, max_version=None, app='pandas', max_version : string, optional Max version number for required package. app : string, optional - Application that is performing the check. For instance, the + Application that is performing the check. For instance, the name of the tutorial being executed that depends on specific packages. checker : object, optional - The class that will perform the version checking. Default is + The class that will perform the version checking. Default is distutils.version.LooseVersion. Examples @@ -2061,17 +2065,6 @@ def package_check(pkg_name, min_version=None, max_version=None, app='pandas', pytest.skip(msg) -def skip_if_no_package(*args, **kwargs): - """pytest.skip() if package_check fails - - Parameters - ---------- - *args Positional parameters passed to `package_check` - *kwargs Keyword parameters passed to `package_check` - """ - package_check(*args, **kwargs) - - def optional_args(decorator): """allows a decorator to take optional positional and keyword arguments. Assumes that taking a single, callable, positional argument means that