Commit 7667296f authored by Tres Seaver's avatar Tres Seaver

Don't leave the Products.__path__ trashed.

parent 67a8e6fa
...@@ -131,6 +131,7 @@ class _TempdirBase: ...@@ -131,6 +131,7 @@ class _TempdirBase:
def _makeTempProduct(self, name='foo', extname='Extensions'): def _makeTempProduct(self, name='foo', extname='Extensions'):
import Products import Products
self._old_Products___path__ = Products.__path__[:]
root = self._makeTempdir() root = self._makeTempdir()
pdir = self._makeTempExtension(name=name, extname=extname, dir=root) pdir = self._makeTempExtension(name=name, extname=extname, dir=root)
Products.__path__ = (root,) Products.__path__ = (root,)
...@@ -187,6 +188,7 @@ class Test_getPath(_TempdirBase, unittest.TestCase): ...@@ -187,6 +188,7 @@ class Test_getPath(_TempdirBase, unittest.TestCase):
def test_wo_checkProduct_skips_product(self): def test_wo_checkProduct_skips_product(self):
import Products import Products
self._old_Products___path__ = Products.__path__
del Products.__path__ # so any iteration will raise del Products.__path__ # so any iteration will raise
instdir = self._makeTempdir() instdir = self._makeTempdir()
instext = self._makeTempExtension(name=None, dir=instdir) instext = self._makeTempExtension(name=None, dir=instdir)
...@@ -349,7 +351,7 @@ class Test_getObject(_TempdirBase, unittest.TestCase): ...@@ -349,7 +351,7 @@ class Test_getObject(_TempdirBase, unittest.TestCase):
MODULES = {} MODULES = {}
extdir = self._makeTempProduct() extdir = self._makeTempProduct()
ext = self._makeFile(extdir, 'extension.py', EXTENSION_PY) ext = self._makeFile(extdir, 'extension.py', EXTENSION_PY)
compile_dir(extdir) compile_dir(extdir, quiet=1)
os.remove(ext) os.remove(ext)
found = self._callFUT('foo.extension', 'named', modules=MODULES) found = self._callFUT('foo.extension', 'named', modules=MODULES)
self.assertEqual(found, 'NAMED') self.assertEqual(found, 'NAMED')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment