summaryrefslogtreecommitdiff
path: root/tests/test_api.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-02-09 10:55:46 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-02-09 10:55:46 -0500
commit29e89f42905d3867932261ccf2b2ac040784b94e (patch)
treed4128b194594d990ae50c5211908eaa8985b3c37 /tests/test_api.py
parentfcb86086705f885480e89f9b28b0dc6ee58d6657 (diff)
downloadpython-coveragepy-29e89f42905d3867932261ccf2b2ac040784b94e.tar.gz
Remove (most) tearDown functions in favor of addCleanup
Diffstat (limited to 'tests/test_api.py')
-rw-r--r--tests/test_api.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/test_api.py b/tests/test_api.py
index 00f6dbe..b075273 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -371,15 +371,13 @@ class UsingModulesMixin(object):
def setUp(self):
super(UsingModulesMixin, self).setUp()
# Parent class saves and restores sys.path, we can just modify it.
- self.old_dir = os.getcwd()
+ old_dir = os.getcwd()
os.chdir(self.nice_file(os.path.dirname(__file__), 'modules'))
+ self.addCleanup(os.chdir, old_dir)
+
sys.path.append(".")
sys.path.append("../moremodules")
- def tearDown(self):
- os.chdir(self.old_dir)
- super(UsingModulesMixin, self).tearDown()
-
class OmitIncludeTestsMixin(UsingModulesMixin):
"""Test methods for coverage methods taking include and omit."""