summaryrefslogtreecommitdiff
path: root/tests/coveragetest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/coveragetest.py')
-rw-r--r--tests/coveragetest.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index 0e6131fb..4d9540d0 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -31,6 +31,9 @@ from tests.helpers import run_command, SuperModuleCleaner
# Status returns for the command line.
OK, ERR = 0, 1
+# The coverage/tests directory, for all sorts of finding test helping things.
+TESTS_DIR = os.path.dirname(__file__)
+
def convert_skip_exceptions(method):
"""A decorator for test methods to convert StopEverything to SkipTest."""
@@ -490,6 +493,17 @@ class CoverageTest(
return self.squeezed_lines(report)[-1]
+class UsingModulesMixin(object):
+ """A mixin for importing modules from tests/modules and tests/moremodules."""
+
+ def setUp(self):
+ super(UsingModulesMixin, self).setUp()
+
+ # Parent class saves and restores sys.path, we can just modify it.
+ sys.path.append(self.nice_file(TESTS_DIR, 'modules'))
+ sys.path.append(self.nice_file(TESTS_DIR, 'moremodules'))
+
+
def command_line(args, **kwargs):
"""Run `args` through the CoverageScript command line.