diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-02-11 14:01:04 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-02-11 14:01:04 -0500 |
commit | dbadb3c93571fa969cf8bb0011b2f54db822693f (patch) | |
tree | 6611d3b4bb0a83ffc5b8dc55b4283578aed56c3a | |
parent | 8db9a3d0ec940128877d6ddf326b6d9ec721c23f (diff) | |
download | python-coveragepy-git-dbadb3c93571fa969cf8bb0011b2f54db822693f.tar.gz |
Use the test-specific chdir method
-rw-r--r-- | tests/test_api.py | 4 | ||||
-rw-r--r-- | tests/test_files.py | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index eaeabcb4..7530aca1 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -376,9 +376,7 @@ class UsingModulesMixin(object): def setUp(self): super(UsingModulesMixin, self).setUp() - old_dir = os.getcwd() - os.chdir(self.nice_file(os.path.dirname(__file__), 'modules')) - self.addCleanup(os.chdir, old_dir) + self.chdir(self.nice_file(os.path.dirname(__file__), 'modules')) # Parent class saves and restores sys.path, we can just modify it. sys.path.append(".") diff --git a/tests/test_files.py b/tests/test_files.py index caab5b47..dadb22b5 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -38,7 +38,7 @@ class FilesTest(CoverageTest): a1 = self.abs_path("sub/proj1/file1.py") a2 = self.abs_path("sub/proj2/file2.py") d = os.path.normpath("sub/proj1") - os.chdir(d) + self.chdir(d) files.set_relative_directory() self.assertEqual(files.relative_filename(a1), "file1.py") self.assertEqual(files.relative_filename(a2), a2) |