diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-27 23:02:29 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-12-27 23:02:29 -0500 |
commit | 9d89805e5a4a9969387f58f7b299231ae7ec8486 (patch) | |
tree | 71174dd5ba518ca36e4663f0a7c24ac123ac023d /test/test_farm.py | |
parent | cd1929b269118e6f335aea74165e9366b3c3ac42 (diff) | |
download | python-coveragepy-git-9d89805e5a4a9969387f58f7b299231ae7ec8486.tar.gz |
Add more tests of omitting files during HTML reporting, and a better way to enable re-importing modules during test_farm tests.
Diffstat (limited to 'test/test_farm.py')
-rw-r--r-- | test/test_farm.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/test_farm.py b/test/test_farm.py index 006a1fb1..630f1011 100644 --- a/test/test_farm.py +++ b/test/test_farm.py @@ -3,7 +3,7 @@ import difflib, filecmp, fnmatch, glob, os, re, shutil, sys sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k -from backtest import run_command, execfile, reload # pylint: disable-msg=W0622 +from backtest import run_command, execfile # pylint: disable-msg=W0622 def test_farm(clean_only=False): @@ -75,12 +75,15 @@ class FarmTestCase(object): if self.dont_clean: glo['clean'] = self.noop - glo['reload'] = reload - + old_mods = dict(sys.modules) try: execfile(self.runpy, glo) finally: self.cd(cwd) + # Remove any new modules imported during the test run. This lets us + # import the same source files for more than one test. + for m in [m for m in sys.modules if m not in old_mods]: + del sys.modules[m] def run_fully(self): # pragma: no cover """Run as a full test case, with setUp and tearDown.""" |