[Python-checkins] cpython: Remove redundant setUp/tearDown methods in packaging tests

eric.araujo python-checkins at python.org
Tue Nov 15 16:13:55 CET 2011


http://hg.python.org/cpython/rev/f1724c576905
changeset: 73567:f1724c576905
user: Éric Araujo <merwok at netwok.org>
date: Mon Nov 14 19:46:31 2011 +0100
summary:
 Remove redundant setUp/tearDown methods in packaging tests
files:
 Lib/packaging/tests/test_manifest.py | 8 --------
 Lib/packaging/tests/test_uninstall.py | 9 ++-------
 Lib/packaging/tests/test_util.py | 8 --------
 3 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/Lib/packaging/tests/test_manifest.py b/Lib/packaging/tests/test_manifest.py
--- a/Lib/packaging/tests/test_manifest.py
+++ b/Lib/packaging/tests/test_manifest.py
@@ -27,14 +27,6 @@
 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(), [])
 
diff --git a/Lib/packaging/tests/test_uninstall.py b/Lib/packaging/tests/test_uninstall.py
--- a/Lib/packaging/tests/test_uninstall.py
+++ b/Lib/packaging/tests/test_uninstall.py
@@ -31,14 +31,9 @@
 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 @@
 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
diff --git a/Lib/packaging/tests/test_util.py b/Lib/packaging/tests/test_util.py
--- a/Lib/packaging/tests/test_util.py
+++ b/Lib/packaging/tests/test_util.py
@@ -602,14 +602,6 @@
 
 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)
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /