From d64ce6cc01fcb20c2e043c822aeaa3790b59ee74 Mon Sep 17 00:00:00 2001 From: Bob Girard Date: Mon, 22 Jun 2015 17:24:30 -0700 Subject: [PATCH] Bundle tests with applications - For each application, add ./tests directory and __init__.py file within it. - Modify test controllers (coverage.py, runtests.py) to find the new test directories for testing and coverage analysis. - Move existing application-specific test modules (test_pagekite.py) to the newly created directories. --- plinth/modules/apps/tests/__init__.py | 0 plinth/modules/config/tests/__init__.py | 0 plinth/modules/deluge/tests/__init__.py | 0 plinth/modules/diagnostics/tests/__init__.py | 0 plinth/modules/dynamicdns/tests/__init__.py | 0 plinth/modules/firewall/tests/__init__.py | 0 plinth/modules/first_boot/tests/__init__.py | 0 plinth/modules/help/tests/__init__.py | 0 plinth/modules/ikiwiki/tests/__init__.py | 0 plinth/modules/mumble/tests/__init__.py | 0 plinth/modules/networks/tests/__init__.py | 0 plinth/modules/owncloud/tests/__init__.py | 0 plinth/modules/packages/tests/__init__.py | 0 plinth/modules/pagekite/tests/__init__.py | 0 plinth/{ => modules/pagekite}/tests/test_pagekite.py | 0 plinth/modules/privoxy/tests/__init__.py | 0 plinth/modules/roundcube/tests/__init__.py | 0 plinth/modules/system/tests/__init__.py | 0 plinth/modules/tor/tests/__init__.py | 0 plinth/modules/transmission/tests/__init__.py | 0 plinth/modules/upgrades/tests/__init__.py | 0 plinth/modules/users/tests/__init__.py | 0 plinth/modules/xmpp/tests/__init__.py | 0 plinth/tests/coverage/coverage.py | 5 ++++- plinth/tests/runtests.py | 9 +++++++-- 25 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 plinth/modules/apps/tests/__init__.py create mode 100644 plinth/modules/config/tests/__init__.py create mode 100644 plinth/modules/deluge/tests/__init__.py create mode 100644 plinth/modules/diagnostics/tests/__init__.py create mode 100644 plinth/modules/dynamicdns/tests/__init__.py create mode 100644 plinth/modules/firewall/tests/__init__.py create mode 100644 plinth/modules/first_boot/tests/__init__.py create mode 100644 plinth/modules/help/tests/__init__.py create mode 100644 plinth/modules/ikiwiki/tests/__init__.py create mode 100644 plinth/modules/mumble/tests/__init__.py create mode 100644 plinth/modules/networks/tests/__init__.py create mode 100644 plinth/modules/owncloud/tests/__init__.py create mode 100644 plinth/modules/packages/tests/__init__.py create mode 100644 plinth/modules/pagekite/tests/__init__.py rename plinth/{ => modules/pagekite}/tests/test_pagekite.py (100%) create mode 100644 plinth/modules/privoxy/tests/__init__.py create mode 100644 plinth/modules/roundcube/tests/__init__.py create mode 100644 plinth/modules/system/tests/__init__.py create mode 100644 plinth/modules/tor/tests/__init__.py create mode 100644 plinth/modules/transmission/tests/__init__.py create mode 100644 plinth/modules/upgrades/tests/__init__.py create mode 100644 plinth/modules/users/tests/__init__.py create mode 100644 plinth/modules/xmpp/tests/__init__.py diff --git a/plinth/modules/apps/tests/__init__.py b/plinth/modules/apps/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/config/tests/__init__.py b/plinth/modules/config/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/deluge/tests/__init__.py b/plinth/modules/deluge/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/diagnostics/tests/__init__.py b/plinth/modules/diagnostics/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/dynamicdns/tests/__init__.py b/plinth/modules/dynamicdns/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/firewall/tests/__init__.py b/plinth/modules/firewall/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/first_boot/tests/__init__.py b/plinth/modules/first_boot/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/help/tests/__init__.py b/plinth/modules/help/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/ikiwiki/tests/__init__.py b/plinth/modules/ikiwiki/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/mumble/tests/__init__.py b/plinth/modules/mumble/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/networks/tests/__init__.py b/plinth/modules/networks/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/owncloud/tests/__init__.py b/plinth/modules/owncloud/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/packages/tests/__init__.py b/plinth/modules/packages/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/pagekite/tests/__init__.py b/plinth/modules/pagekite/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/tests/test_pagekite.py b/plinth/modules/pagekite/tests/test_pagekite.py similarity index 100% rename from plinth/tests/test_pagekite.py rename to plinth/modules/pagekite/tests/test_pagekite.py diff --git a/plinth/modules/privoxy/tests/__init__.py b/plinth/modules/privoxy/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/roundcube/tests/__init__.py b/plinth/modules/roundcube/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/system/tests/__init__.py b/plinth/modules/system/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/tor/tests/__init__.py b/plinth/modules/tor/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/transmission/tests/__init__.py b/plinth/modules/transmission/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/upgrades/tests/__init__.py b/plinth/modules/upgrades/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/users/tests/__init__.py b/plinth/modules/users/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/modules/xmpp/tests/__init__.py b/plinth/modules/xmpp/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/plinth/tests/coverage/coverage.py b/plinth/tests/coverage/coverage.py index 965bf3393..3c12c7042 100644 --- a/plinth/tests/coverage/coverage.py +++ b/plinth/tests/coverage/coverage.py @@ -37,7 +37,10 @@ import time SOURCE_DIRS = ['plinth'] + glob.glob('plinth/modules/*') # Files to exclude from coverage analysis and reporting -FILES_TO_OMIT = ['plinth/tests/*.py'] +FILES_TO_OMIT = [ + 'plinth/tests/*.py', + 'plinth/modules/*/tests/*.py' +] # Location of coverage HTML report files COVERAGE_REPORT_DIR = 'plinth/tests/coverage/report' diff --git a/plinth/tests/runtests.py b/plinth/tests/runtests.py index 992b82509..7a8e8ad91 100644 --- a/plinth/tests/runtests.py +++ b/plinth/tests/runtests.py @@ -37,9 +37,14 @@ def run_tests(pattern=None, return_to_caller=False): test_runner = TestRunner() if pattern is None: - pattern = 'plinth.tests' + pattern_list = [ + 'plinth/tests', + 'plinth/modules' + ] + else: + pattern_list = [pattern] - failures = test_runner.run_tests([pattern]) + failures = test_runner.run_tests(pattern_list) if failures > 0 or not return_to_caller: sys.exit(bool(failures))