diff options
author | R. David Murray <rdmurray@bitdance.com> | 2010-02-23 00:24:49 +0000 |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2010-02-23 00:24:49 +0000 |
commit | f28fd24c36310541a1f3ec74e92e8d38629dd5d8 (patch) | |
tree | ca85998492ba91f8874ba63fecd77397f65ad3d6 /Lib/test/test_pkg.py | |
parent | 87bcb243acfd758b3e91e194bf8f1198ae68a792 (diff) | |
download | cpython-git-f28fd24c36310541a1f3ec74e92e8d38629dd5d8.tar.gz |
Issue 6292: for the moment at least, the test suite passes if run
with -OO. Tests requiring docstrings are skipped. Patch by
Brian Curtin, thanks to Matias Torchinsky for helping review and
improve the patch.
Diffstat (limited to 'Lib/test/test_pkg.py')
-rw-r--r-- | Lib/test/test_pkg.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index e3b86e6d8e..6fb3f3d794 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -51,7 +51,8 @@ class Test(unittest.TestCase): def tearDown(self): sys.path[:] = self.syspath - cleanout(self.root) + if self.root: # Only clean if the test was actually run + cleanout(self.root) # delete all modules concerning the tested hiearchy if self.pkgname: @@ -101,9 +102,6 @@ class Test(unittest.TestCase): ] self.mkhier(hier) - import t2 - self.assertEqual(t2.__doc__, "doc for t2") - import t2.sub import t2.sub.subsub self.assertEqual(t2.__name__, "t2") @@ -274,6 +272,17 @@ class Test(unittest.TestCase): self.assertFalse(sub) self.assertFalse(subsub) + @unittest.skipIf(sys.flags.optimize >= 2, + "Docstrings are omitted with -O2 and above") + def test_8(self): + hier = [ + ("t8", None), + ("t8 __init__"+os.extsep+"py", "'doc for t8'"), + ] + self.mkhier(hier) + + import t8 + self.assertEqual(t8.__doc__, "doc for t8") def test_main(): test_support.run_unittest(__name__) |