diff options
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 2e293f4..2c19589 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -53,7 +53,8 @@ class TestPkg(unittest.TestCase): def tearDown(self): sys.path[:] = self.syspath support.modules_cleanup(*self.modules_before) - 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: @@ -103,9 +104,6 @@ class TestPkg(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") @@ -276,6 +274,17 @@ class TestPkg(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(): support.run_unittest(__name__) |