diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-09 10:55:46 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-09 10:55:46 -0500 |
commit | c241ca7e844eafc5f06bdac8852c8b026cfa0c83 (patch) | |
tree | f9e0c65d7f0c41ddb2bba46bd4ebc9aaffbd07b0 /tests/test_api.py | |
parent | 3f5d571b0146531ceae5c57ed15fafaca3202be7 (diff) | |
download | python-coveragepy-git-c241ca7e844eafc5f06bdac8852c8b026cfa0c83.tar.gz |
Remove (most) tearDown functions in favor of addCleanup
Diffstat (limited to 'tests/test_api.py')
-rw-r--r-- | tests/test_api.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index 00f6dbe8..b0752730 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.""" |