aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--debian/copyright2
-rw-r--r--debian/tests/control3
-rw-r--r--debian/tests/run-tests.py23
3 files changed, 27 insertions, 1 deletions
diff --git a/debian/copyright b/debian/copyright
index 670486c..4a6dc15 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -2,7 +2,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: gallery_dl
Source: https://github.com/mikf/gallery-dl
-Files: *
+Files: * debian/tests/run-tests.py
Copyright: 2014-2020, Mike Fährmann <mike_faehrmann@web.de>
2016-2019, Leonardo Taccari
License: GPL-2.0
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..6724131
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
+Tests: run-tests.py
+Depends: @, @builddeps@, python3-nose
+Restrictions: allow-stderr
diff --git a/debian/tests/run-tests.py b/debian/tests/run-tests.py
new file mode 100644
index 0000000..11feaed
--- /dev/null
+++ b/debian/tests/run-tests.py
@@ -0,0 +1,23 @@
+#!/bin/bash
+# This is a slightly modified version of upstream's scripts/run_tests.py
+
+TESTS_CORE=(cache config cookies downloader extractor oauth postprocessor text util)
+TESTS_RESULTS=(results)
+
+
+# select tests
+case "${1:-${GALLERYDL_TESTS:-core}}" in
+ core) TESTS=( ${TESTS_CORE[@]} );;
+ results) TESTS=( ${TESTS_RESULTS[@]} );;
+ *) TESTS=( );;
+esac
+
+
+# transform each array element to test_###.py
+TESTS=( ${TESTS[@]/#/test_} )
+TESTS=( ${TESTS[@]/%/.py} )
+
+
+# run 'nosetests3' with selected tests
+# (or all tests if ${TESTS} is empty)
+nosetests3 --verbose -w "test" ${TESTS[@]}