diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/tests/control | 2 | ||||
-rwxr-xr-x | debian/tests/python-upstream.sh | 5 | ||||
-rw-r--r-- | debian/tests/upstream.py | 48 |
4 files changed, 18 insertions, 38 deletions
diff --git a/debian/changelog b/debian/changelog index ea5eaa13..756d0a51 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ gudhi (3.2.0+dfsg-4) UNRELEASED; urgency=medium * Re-enable build-time tests on s390x, no longer failing. + * Simplify autopkgtesting. -- Gard Spreemann <gspr@nonempty.org> Thu, 09 Jul 2020 22:12:29 +0200 diff --git a/debian/tests/control b/debian/tests/control index 0502c5b6..8a844ae1 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -1,3 +1,3 @@ Tests: python-upstream.sh -Depends: python3-all, python3-gudhi, python3-pytest, python3-scipy, python3-sklearn +Depends: python3-all, python3-gudhi, python3-pot, python3-pytest, python3-scipy, python3-sklearn Restrictions: allow-stderr
\ No newline at end of file diff --git a/debian/tests/python-upstream.sh b/debian/tests/python-upstream.sh index 499cc0f2..8fd4695f 100755 --- a/debian/tests/python-upstream.sh +++ b/debian/tests/python-upstream.sh @@ -5,11 +5,14 @@ set -u helper=$PWD/debian/tests/upstream.py testdir=$PWD/src/python/test +cp $helper $AUTOPKGTEST_TMP +cp -R $testdir $AUTOPKGTEST_TMP cd $AUTOPKGTEST_TMP for py3ver in $(py3versions -vs) do echo "Running tests with Python ${py3ver}." - /usr/bin/python${py3ver} -B $helper $testdir + /usr/bin/python${py3ver} -B upstream.py test + rm -rf .pytest_cache echo "**********" done diff --git a/debian/tests/upstream.py b/debian/tests/upstream.py index 869d469e..c21aff8d 100644 --- a/debian/tests/upstream.py +++ b/debian/tests/upstream.py @@ -1,42 +1,18 @@ -import importlib -import os import sys +import itertools +import pytest -blacklist = {"test_knn", "test_subsampling", "test_representations", "test_dtm"} +blacklist = ["test_dtm.py", # Requires hnswlib + "test_knn.py", # Requires pykeops + "test_representations.py", # Look into this + "test_wasserstein_distance.py::test_wasserstein_distance_pot", # Requires eagerpy. + "test_wasserstein_distance.py::test_wasserstein_distance_grad" # Requires eagerpy. + ] -testdir = sys.argv[1] -sys.path.append(testdir) - -results = [] -with os.scandir(testdir) as it: - for entry in it: - if entry.is_file() and entry.name.startswith("test_") and entry.name.endswith(".py"): - name = entry.name[:-3] +print("Blacklist: %s" %(str(blacklist))) - if name in blacklist: - print("Skipping tests in %s due to blacklist." %(name)) - else: - print("Running tests from %s." %(name)) - - module = importlib.import_module(name) +testdir = sys.argv[1] - tests = [f for f in dir(module) if str(f).startswith("test_")] - for t in tests: - func = getattr(module, t) - if callable(func): - print(" ", t) - ok = True - try: - func() - except AssertionError: - ok = False - if ok: - print(" OK!") - else: - print(" FAIL!") - results.append(ok) +deselect_args = list(itertools.chain.from_iterable([["--deselect", "%s/%s" %(testdir, exclude)] for exclude in blacklist])) -if all(results): - exit(0) -else: - exit(1) +pytest.main([testdir] + deselect_args) |