Improvements for test_py3kwarn

- Always show warnings so they are always catchable
- Make test_os_path_walk faster by walking a less populous directory
This commit is contained in:
Benjamin Peterson 2008-05-27 01:42:29 +00:00
parent 838c7b3619
commit 1d31023b31

View file

@ -207,9 +207,7 @@ class TestStdlibRemovals(unittest.TestCase):
for path_mod in ("ntpath", "macpath", "os2emxpath", "posixpath"): for path_mod in ("ntpath", "macpath", "os2emxpath", "posixpath"):
mod = __import__(path_mod) mod = __import__(path_mod)
with catch_warning() as w: with catch_warning() as w:
# Since os3exmpath just imports it from ntpath mod.walk("crashers", dumbo, None)
warnings.simplefilter("always")
mod.walk(".", dumbo, None)
self.assertEquals(str(w.message), msg) self.assertEquals(str(w.message), msg)
def test_commands_members(self): def test_commands_members(self):
@ -223,8 +221,10 @@ class TestStdlibRemovals(unittest.TestCase):
def test_main(): def test_main():
run_unittest(TestPy3KWarnings, with catch_warning(record=True):
TestStdlibRemovals) warnings.simplefilter("always")
run_unittest(TestPy3KWarnings,
TestStdlibRemovals)
if __name__ == '__main__': if __name__ == '__main__':
test_main() test_main()