test_controls
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Fri, 26 Oct 2018 03:45:58 +0000 (11:45 +0800)
committerDrew Parsons <dparsons@debian.org>
Fri, 26 Oct 2018 03:45:58 +0000 (11:45 +0800)
===================================================================

Gbp-Pq: Name test_controls.diff

demo/python/test.py [new file with mode: 0644]
test/test.py [new file with mode: 0644]

diff --git a/demo/python/test.py b/demo/python/test.py
new file mode 100644 (file)
index 0000000..a723c70
--- /dev/null
@@ -0,0 +1,27 @@
+import os
+import pathlib
+import subprocess
+import sys
+import pytest
+
+
+# Get directory of this file
+dir_path = pathlib.Path(__file__).resolve().parent
+
+# Build list of demo programs
+demos = []
+for subdir in ['.']:
+    p = pathlib.Path(dir_path, subdir)
+    demo_files = list(p.glob('*.py'))
+    for f in demo_files:
+        demos.append((f.parent, f.name))
+
+
+@pytest.mark.parametrize("path,name", demos)
+def test_demos(path, name):
+
+    # Run in serial
+    ret = subprocess.run([sys.executable, name],
+                         cwd=str(path),
+                         env={**os.environ, 'MPLBACKEND': 'agg'},
+                         check=True)
diff --git a/test/test.py b/test/test.py
new file mode 100644 (file)
index 0000000..1404174
--- /dev/null
@@ -0,0 +1,30 @@
+import os
+import pathlib
+import subprocess
+import sys
+import pytest
+
+
+# Get directory of this file
+dir_path = pathlib.Path(__file__).resolve().parent
+
+# Build list of demo programs
+tests = []
+for subdir in ['.']:
+    p = pathlib.Path(dir_path, subdir)
+    test_files = list(p.glob('**/*.py'))
+    for f in test_files:
+        tests.append((f.parent, f.name))
+
+
+# remove tests that are known to break
+tests = [d for d in tests if d[1] != 'test-fuzzypointmap.py']
+
+
+@pytest.mark.parametrize("path,name", tests)
+def test_demos(path, name):
+
+    ret = subprocess.run([sys.executable, name],
+                         cwd=str(path),
+                         env={**os.environ, 'MPLBACKEND': 'agg'},
+                         check=True)