summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/test_discovery.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-05-07 20:47:43 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-05-07 20:47:43 (GMT)
commit135d87c23cd7e486d8b85adc0488f4fef1dbdc60 (patch)
tree50a8faa7e2f76d238821f154be2b70bea979ad4b /Lib/unittest/test/test_discovery.py
parentad465f904ba85b94211054881a41d7230474ebc7 (diff)
downloadcpython-135d87c23cd7e486d8b85adc0488f4fef1dbdc60.zip
cpython-135d87c23cd7e486d8b85adc0488f4fef1dbdc60.tar.gz
cpython-135d87c23cd7e486d8b85adc0488f4fef1dbdc60.tar.bz2
Merged revisions 80939 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80939 | benjamin.peterson | 2010-05-07 15:45:07 -0500 (Fri, 07 May 2010) | 1 line revert r80932; it breaks windows ........
Diffstat (limited to 'Lib/unittest/test/test_discovery.py')
-rw-r--r--Lib/unittest/test/test_discovery.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py
index 8253580..1b0f08b 100644
--- a/Lib/unittest/test/test_discovery.py
+++ b/Lib/unittest/test/test_discovery.py
@@ -294,45 +294,6 @@ class TestDiscovery(unittest.TestCase):
self.assertTrue(program.failfast)
self.assertTrue(program.catchbreak)
- def test_detect_module_clash(self):
- class Module(object):
- __file__ = 'bar/foo.py'
- sys.modules['foo'] = Module
- full_path = os.path.abspath('foo')
- original_listdir = os.listdir
- original_isfile = os.path.isfile
- original_isdir = os.path.isdir
-
- def cleanup():
- os.listdir = original_listdir
- os.path.isfile = original_isfile
- os.path.isdir = original_isdir
- del sys.modules['foo']
- if full_path in sys.path:
- sys.path.remove(full_path)
- self.addCleanup(cleanup)
-
- def listdir(_):
- return ['foo.py']
- def isfile(_):
- return True
- def isdir(_):
- return True
- os.listdir = listdir
- os.path.isfile = isfile
- os.path.isdir = isdir
-
- loader = unittest.TestLoader()
-
- mod_dir = os.path.abspath('bar')
- expected_dir = os.path.abspath('foo')
- msg = (r"^'foo' module incorrectly imported from %r\. Expected %r\. "
- "Is this module globally installed\?$") % (mod_dir, expected_dir)
- self.assertRaisesRegexp(
- ImportError, msg, loader.discover,
- start_dir='foo', pattern='foo.py'
- )
- self.assertEqual(sys.path[0], full_path)
if __name__ == '__main__':
unittest.main()