]> granicus.if.org Git - python/commitdiff
Remove redundant setUp/tearDown methods in packaging tests
authorÉric Araujo <merwok@netwok.org>
Mon, 14 Nov 2011 18:46:31 +0000 (19:46 +0100)
committerÉric Araujo <merwok@netwok.org>
Mon, 14 Nov 2011 18:46:31 +0000 (19:46 +0100)
Lib/packaging/tests/test_manifest.py
Lib/packaging/tests/test_uninstall.py
Lib/packaging/tests/test_util.py

index 5f893319389c0bf13a690b2c4a427b9bb173a8e0..f768c473446f6ef4516d02394eff71f482d007aa 100644 (file)
@@ -27,14 +27,6 @@ class ManifestTestCase(support.TempdirManager,
                        support.LoggingCatcher,
                        unittest.TestCase):
 
-    def setUp(self):
-        super(ManifestTestCase, self).setUp()
-        self.cwd = os.getcwd()
-
-    def tearDown(self):
-        os.chdir(self.cwd)
-        super(ManifestTestCase, self).tearDown()
-
     def assertNoWarnings(self):
         self.assertEqual(self.get_logs(), [])
 
index 9e03b5433c8e7cadafb6837befe500511854b7ac..b0d9ba739872efb69959aa4f045ae0f9441b14f5 100644 (file)
@@ -31,14 +31,9 @@ class UninstallTestCase(support.TempdirManager,
     def setUp(self):
         super(UninstallTestCase, self).setUp()
         self.addCleanup(enable_cache)
-        self.root_dir = self.mkdtemp()
-        self.cwd = os.getcwd()
+        self.addCleanup(packaging.util._path_created.clear)
         disable_cache()
 
-    def tearDown(self):
-        packaging.util._path_created.clear()
-        super(UninstallTestCase, self).tearDown()
-
     def get_path(self, dist, name):
         # the dist argument must contain an install_dist command correctly
         # initialized with a prefix option and finalized befored this method
@@ -79,7 +74,7 @@ class UninstallTestCase(support.TempdirManager,
         dist.parse_config_files()
         dist.finalize_options()
         dist.run_command('install_dist',
-                         {'prefix': ('command line', self.root_dir)})
+                         {'prefix': ('command line', self.mkdtemp())})
 
         site_packages = self.get_path(dist, 'purelib')
         return dist, site_packages
index 262fef4d3d3b2dca9fcd5a691e7715a691d39613..737503ebf660c2e0ac010a97abd2c6767ad0ef20 100644 (file)
@@ -602,14 +602,6 @@ class GlobTestCaseBase(support.TempdirManager,
 
 class GlobTestCase(GlobTestCaseBase):
 
-    def setUp(self):
-        super(GlobTestCase, self).setUp()
-        self.cwd = os.getcwd()
-
-    def tearDown(self):
-        os.chdir(self.cwd)
-        super(GlobTestCase, self).tearDown()
-
     def assertGlobMatch(self, glob, spec):
         tempdir = self.build_files_tree(spec)
         expected = self.clean_tree(spec)