From 67f905e4b7002d71d7ab33b87089a876eb4ef66c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 4 May 2017 07:35:24 -0400 Subject: Refactor common test infrastructure for fiddling sys.path and finding files --- tests/test_filereporter.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'tests/test_filereporter.py') diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py index 59eafa11..91e47762 100644 --- a/tests/test_filereporter.py +++ b/tests/test_filereporter.py @@ -4,12 +4,11 @@ """Tests for FileReporters""" import os -import sys from coverage.plugin import FileReporter from coverage.python import PythonFileReporter -from tests.coveragetest import CoverageTest +from tests.coveragetest import CoverageTest, UsingModulesMixin # pylint: disable=import-error # Unable to import 'aa' (No module named aa) @@ -20,17 +19,11 @@ def native(filename): return filename.replace("/", os.sep) -class FileReporterTest(CoverageTest): +class FileReporterTest(UsingModulesMixin, CoverageTest): """Tests for FileReporter classes.""" run_in_temp_dir = False - def setUp(self): - super(FileReporterTest, self).setUp() - # Parent class saves and restores sys.path, we can just modify it. - testmods = self.nice_file(os.path.dirname(__file__), 'modules') - sys.path.append(testmods) - def test_filenames(self): acu = PythonFileReporter("aa/afile.py") bcu = PythonFileReporter("aa/bb/bfile.py") -- cgit v1.2.1