[Python-checkins] distutils2: Fixed test error involving pkgutil's caching

tarek.ziade python-checkins at python.org
Sat Oct 2 00:52:20 CEST 2010


tarek.ziade pushed ea3d00815339 to distutils2:
http://hg.python.org/distutils2/rev/ea3d00815339
changeset: 725:ea3d00815339
parent: 690:37f948f6be6c
user: Jeremy Kloth <jeremy.kloth at gmail.com>
date: Fri Oct 01 13:31:28 2010 -0600
summary: Fixed test error involving pkgutil's caching
files: distutils2/_backport/tests/test_pkgutil.py, distutils2/tests/test_depgraph.py
diff --git a/distutils2/_backport/tests/test_pkgutil.py b/distutils2/_backport/tests/test_pkgutil.py
--- a/distutils2/_backport/tests/test_pkgutil.py
+++ b/distutils2/_backport/tests/test_pkgutil.py
@@ -39,10 +39,12 @@
 super(TestPkgUtilData, self).setUp()
 self.dirname = tempfile.mkdtemp()
 sys.path.insert(0, self.dirname)
+ pkgutil.disable_cache()
 
 def tearDown(self):
 super(TestPkgUtilData, self).tearDown()
 del sys.path[0]
+ pkgutil.enable_cache()
 shutil.rmtree(self.dirname)
 
 def test_getdata_filesys(self):
@@ -139,10 +141,12 @@
 
 def setUp(self):
 super(TestPkgUtilPEP302, self).setUp()
+ pkgutil.disable_cache()
 sys.meta_path.insert(0, self.MyTestImporter())
 
 def tearDown(self):
 del sys.meta_path[0]
+ pkgutil.enable_cache()
 super(TestPkgUtilPEP302, self).tearDown()
 
 def test_getdata_pep302(self):
@@ -168,6 +172,7 @@
 super(TestPkgUtilDistribution, self).setUp()
 self.fake_dists_path = os.path.abspath(
 os.path.join(os.path.dirname(__file__), 'fake_dists'))
+ pkgutil.disable_cache()
 
 self.distinfo_dirs = [os.path.join(self.fake_dists_path, dir)
 for dir in os.listdir(self.fake_dists_path)
@@ -214,6 +219,7 @@
 for distinfo_dir in self.distinfo_dirs:
 record_file = os.path.join(distinfo_dir, 'RECORD')
 open(record_file, 'w').close()
+ pkgutil.enable_cache()
 super(TestPkgUtilDistribution, self).tearDown()
 
 def test_instantiation(self):
@@ -322,6 +328,7 @@
 
 def setUp(self):
 super(TestPkgUtilPEP376, self).setUp()
+ pkgutil.disable_cache()
 # Setup the path environment with our fake distributions
 current_path = os.path.abspath(os.path.dirname(__file__))
 self.sys_path = sys.path[:]
@@ -330,6 +337,7 @@
 
 def tearDown(self):
 sys.path[:] = self.sys_path
+ pkgutil.enable_cache()
 super(TestPkgUtilPEP376, self).tearDown()
 
 def test_distinfo_dirname(self):
diff --git a/distutils2/tests/test_depgraph.py b/distutils2/tests/test_depgraph.py
--- a/distutils2/tests/test_depgraph.py
+++ b/distutils2/tests/test_depgraph.py
@@ -33,6 +33,7 @@
 path = os.path.abspath(path)
 self.sys_path = sys.path[:]
 sys.path[0:0] = [path]
+ pkgutil.disable_cache()
 
 def test_generate_graph(self):
 dists = []
@@ -178,6 +179,7 @@
 
 def tearDown(self):
 super(DepGraphTestCase, self).tearDown()
+ pkgutil.enable_cache()
 sys.path = self.sys_path
 
 def test_suite():
--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list

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