summaryrefslogtreecommitdiff
path: root/test/test_api.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-10-27 17:11:02 -0400
committerNed Batchelder <ned@nedbatchelder.com>2012-10-27 17:11:02 -0400
commitacb2a6f32ca12db086b5f8e0510965d8d563e551 (patch)
tree27507e021b19d50d24a6a718f87c695159bcc8f3 /test/test_api.py
parentdd9064a26b08508b2d8032c28586e25692b63787 (diff)
downloadpython-coveragepy-git-acb2a6f32ca12db086b5f8e0510965d8d563e551.tar.gz
Make a mixin for a test: super is hard, let's go shopping.
Diffstat (limited to 'test/test_api.py')
-rw-r--r--test/test_api.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/test_api.py b/test/test_api.py
index 48f10829..3f511888 100644
--- a/test/test_api.py
+++ b/test/test_api.py
@@ -346,13 +346,13 @@ class ApiTest(CoverageTest):
cov.report()
-class SourceOmitIncludeTest(CoverageTest):
- """Test using `source`, `omit` and `include` when measuring code."""
+class UsingModulesMixin(object):
+ """A mixin for importing modules from test/modules and test/moremodules."""
run_in_temp_dir = False
def setUp(self):
- super(SourceOmitIncludeTest, self).setUp()
+ super(UsingModulesMixin, self).setUp()
# Parent class saves and restores sys.path, we can just modify it.
self.old_dir = os.getcwd()
os.chdir(self.nice_file(os.path.dirname(__file__), 'modules'))
@@ -361,7 +361,11 @@ class SourceOmitIncludeTest(CoverageTest):
def tearDown(self):
os.chdir(self.old_dir)
- super(SourceOmitIncludeTest, self).tearDown()
+ super(UsingModulesMixin, self).tearDown()
+
+
+class SourceOmitIncludeTest(UsingModulesMixin, CoverageTest):
+ """Test using `source`, `omit` and `include` when measuring code."""
def coverage_usepkgs_summary(self, **kwargs):
"""Run coverage on usepkgs and return the line summary.