summaryrefslogtreecommitdiff
path: root/debian/tests
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/control3
-rwxr-xr-xdebian/tests/python-upstream.sh20
-rw-r--r--debian/tests/upstream.py19
3 files changed, 42 insertions, 0 deletions
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 00000000..d5970de3
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: python-upstream.sh
+Depends: python3-all, python3-eagerpy, python3-gudhi, python3-matplotlib, python3-pot, python3-pytest, python3-scipy, python3-sklearn, python3-tk
+Restrictions: allow-stderr \ No newline at end of file
diff --git a/debian/tests/python-upstream.sh b/debian/tests/python-upstream.sh
new file mode 100755
index 00000000..36d5031c
--- /dev/null
+++ b/debian/tests/python-upstream.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+set -e
+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
+
+rm -f test/test_dtm.py # Imports torch too early.
+
+for py3ver in $(py3versions -vs)
+do
+ echo "Running tests with Python ${py3ver}."
+ /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
new file mode 100644
index 00000000..1b4caffe
--- /dev/null
+++ b/debian/tests/upstream.py
@@ -0,0 +1,19 @@
+import sys
+import itertools
+import pytest
+
+blacklist = ["test_dtm.py", # Requires hnswlib
+ "test_knn.py", # Requires pykeops
+ "test_representations.py", # Look into this
+ "test_tomato.py", # Wants to use X.
+ "test_wasserstein_distance.py::test_wasserstein_distance_grad" # Requires PyTorch.
+ ]
+
+print("Blacklist: %s" %(str(blacklist)))
+
+testdir = sys.argv[1]
+
+deselect_args = list(itertools.chain.from_iterable([["--deselect", "%s/%s" %(testdir, exclude)] for exclude in blacklist]))
+
+exitcode = pytest.main([testdir] + deselect_args)
+exit(exitcode)