summaryrefslogtreecommitdiff
path: root/tests/test_execfile.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-05-04 07:35:24 -0400
committerNed Batchelder <ned@nedbatchelder.com>2017-05-04 07:35:24 -0400
commit67f905e4b7002d71d7ab33b87089a876eb4ef66c (patch)
tree44bb3f7b60ca37933e1adc887367c771777cbbb2 /tests/test_execfile.py
parentb48ec04376ae5c9103bb73e1146473d70c1e5c8e (diff)
downloadpython-coveragepy-git-67f905e4b7002d71d7ab33b87089a876eb4ef66c.tar.gz
Refactor common test infrastructure for fiddling sys.path and finding files
Diffstat (limited to 'tests/test_execfile.py')
-rw-r--r--tests/test_execfile.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index bad3da90..032eaa29 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -8,16 +8,15 @@ import json
import os
import os.path
import re
-import sys
from coverage import env
from coverage.backward import binary_bytes
from coverage.execfile import run_python_file, run_python_module
from coverage.misc import NoCode, NoSource
-from tests.coveragetest import CoverageTest
+from tests.coveragetest import CoverageTest, TESTS_DIR, UsingModulesMixin
-TRY_EXECFILE = os.path.join(os.path.dirname(__file__), "modules/process_test/try_execfile.py")
+TRY_EXECFILE = os.path.join(TESTS_DIR, "modules/process_test/try_execfile.py")
class RunFileTest(CoverageTest):
@@ -170,16 +169,11 @@ class RunPycFileTest(CoverageTest):
run_python_file(bf, [bf])
-class RunModuleTest(CoverageTest):
+class RunModuleTest(UsingModulesMixin, CoverageTest):
"""Test run_python_module."""
run_in_temp_dir = False
- def setUp(self):
- super(RunModuleTest, self).setUp()
- # Parent class saves and restores sys.path, we can just modify it.
- sys.path.append(self.nice_file(os.path.dirname(__file__), 'modules'))
-
def test_runmod1(self):
run_python_module("runmod1", ["runmod1", "hello"])
self.assertEqual(self.stderr(), "")