@@ -2010,12 +2010,16 @@ def __init__(self, *args, **kwargs):
2010
2010
dict .__init__ (self , * args , ** kwargs )
2011
2011
2012
2012
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 ):
2017
2019
"""Check that the min/max version of the required package is installed.
2018
2020
2021
+ If the package check fails, the test is automatically skipped.
2022
+
2019
2023
Parameters
2020
2024
----------
2021
2025
pkg_name : string
@@ -2025,11 +2029,11 @@ def package_check(pkg_name, min_version=None, max_version=None, app='pandas',
2025
2029
max_version : string, optional
2026
2030
Max version number for required package.
2027
2031
app : string, optional
2028
- Application that is performing the check. For instance, the
2032
+ Application that is performing the check. For instance, the
2029
2033
name of the tutorial being executed that depends on specific
2030
2034
packages.
2031
2035
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
2033
2037
distutils.version.LooseVersion.
2034
2038
2035
2039
Examples
@@ -2061,17 +2065,6 @@ def package_check(pkg_name, min_version=None, max_version=None, app='pandas',
2061
2065
pytest .skip (msg )
2062
2066
2063
2067
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
-
2075
2068
def optional_args (decorator ):
2076
2069
"""allows a decorator to take optional positional and keyword arguments.
2077
2070
Assumes that taking a single, callable, positional argument means that
0 commit comments