diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-11-08 18:32:40 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-11-08 18:32:40 (GMT) |
commit | 6672ea942447f409871bd19c928521be13aae1e5 (patch) | |
tree | d80463f40fc3f9ddae700b44730ef53eb4f5ce6f /Lib/test/test_trace.py | |
parent | 551f02ca630ad68a8797a8949e83bfc31c3f4cbf (diff) | |
download | cpython-6672ea942447f409871bd19c928521be13aae1e5.zip cpython-6672ea942447f409871bd19c928521be13aae1e5.tar.gz cpython-6672ea942447f409871bd19c928521be13aae1e5.tar.bz2 |
Streamlined code in trace.Ignore and added unit tests.
Diffstat (limited to 'Lib/test/test_trace.py')
-rw-r--r-- | Lib/test/test_trace.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index 33d7aa1..9c018b7 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -334,6 +334,20 @@ class TestCoverage(unittest.TestCase): self.assertIn(modname, coverage) self.assertEqual(coverage[modname], (5, 100)) +### Tests that don't mess with sys.settrace and can be traced +### themselves TODO: Skip tests that do mess with sys.settrace when +### regrtest is invoked with -T option. +class Test_Ignore(unittest.TestCase): + def test_ignored(self): + ignore = trace.Ignore(['x', 'y.z'], ['/foo/bar']) + self.assertTrue(ignore.names('x.py', 'x')) + self.assertFalse(ignore.names('xy.py', 'xy')) + self.assertFalse(ignore.names('y.py', 'y')) + self.assertTrue(ignore.names('/foo/bar/baz.py', 'baz')) + self.assertFalse(ignore.names('bar/z.py', 'z')) + # Matched before. + self.assertTrue(ignore.names('bar/baz.py', 'baz')) + def test_main(): run_unittest(__name__) |