From 86f297f0869b2c58ed751c87dc40fa2cb6cf8c32 Mon Sep 17 00:00:00 2001 From: Roman Yurchak Date: Thu, 10 Oct 2019 13:48:38 +0200 Subject: [PATCH 1/2] More fixes to include test/ folder in sdist --- setup.py | 4 ++-- tslearn/tests/test_estimators.py | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/setup.py b/setup.py index 6d48aac7b..7f5aae4e5 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,4 @@ -from setuptools import setup +from setuptools import setup, find_packages from codecs import open import numpy import os @@ -22,7 +22,7 @@ long_description=README, long_description_content_type='text/markdown', include_dirs=[numpy.get_include()], - packages=['tslearn'], + packages=find_packages(), package_data={"tslearn": [".cached_datasets/Trace.npz"]}, data_files=[("", ["LICENSE"])], install_requires=['numpy', 'scipy', 'scikit-learn', 'Cython', 'numba', diff --git a/tslearn/tests/test_estimators.py b/tslearn/tests/test_estimators.py index 092b4a484..643e50c53 100644 --- a/tslearn/tests/test_estimators.py +++ b/tslearn/tests/test_estimators.py @@ -59,7 +59,19 @@ def _get_all_classes(): base_path = tslearn.__path__ for _, name, _ in pkgutil.walk_packages(path=base_path, prefix='tslearn.'): - module = __import__(name, fromlist="dummy") + try: + module = __import__(name, fromlist="dummy") + except ImportError: + if name.endswith('shapelets'): + # keras is likely not installed + warnings.warn('Skipped common tests for shapelets ' + 'as it could not be imported. keras ' + '(and tensorflow) are probably not ' + 'installed!') + continue + else: + raise + all_classes.extend(inspect.getmembers(module, inspect.isclass)) return all_classes @@ -169,11 +181,11 @@ def check_estimator(Estimator): warnings.warn(str(exception), SkipTestWarning) -@pytest.mark.parametrize('estimator', get_estimators('all')) -def test_all_estimators(estimator): +@pytest.mark.parametrize('name, Estimator', get_estimators('all')) +def test_all_estimators(name, Estimator): """Test all the estimators in tslearn.""" allow_nan = (hasattr(checks, 'ALLOW_NAN') and - _safe_tags(estimator[1](), "allow_nan")) + _safe_tags(Estimator(), "allow_nan")) if allow_nan: - checks.ALLOW_NAN.append(estimator[0]) - check_estimator(estimator[1]) + checks.ALLOW_NAN.append(name) + check_estimator(Estimator) From b7499aaabe2ee3a2727f10643c575360053cd365 Mon Sep 17 00:00:00 2001 From: Romain Tavenard Date: Thu, 10 Oct 2019 23:05:34 +0200 Subject: [PATCH 2/2] Version 0.2.5 --- tslearn/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tslearn/__init__.py b/tslearn/__init__.py index f4be06c17..c2ad18a63 100644 --- a/tslearn/__init__.py +++ b/tslearn/__init__.py @@ -1,7 +1,7 @@ import os __author__ = 'Romain Tavenard romain.tavenard[at]univ-rennes2.fr' -__version__ = "0.2.4" +__version__ = "0.2.5" __bibtex__ = r"""@misc{tslearn, title={tslearn: A machine learning toolkit dedicated to time-series data}, author={Tavenard, Romain and Faouzi, Johann and Vandewiele, Gilles},