Rev 4701: (Harald Meland) Make test_no_asserts 7x faster. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Sep 18 04:34:32 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4701 [merge]
revision-id: pqm at pqm.ubuntu.com-20090918033431-imjyd17yze1okeap
parent: pqm at pqm.ubuntu.com-20090918025119-eqkrmtj09t2hqs2t
parent: haraldme at gmail.com-20090917191658-llo8v39rp2myh00n
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-09-18 04:34:31 +0100
message:
  (Harald Meland) Make test_no_asserts 7x faster.
modified:
  bzrlib/tests/test_source.py    test_source.py-20051207061333-a58dea6abecc030d
=== modified file 'bzrlib/tests/test_source.py'
--- a/bzrlib/tests/test_source.py	2009-09-10 03:44:53 +0000
+++ b/bzrlib/tests/test_source.py	2009-09-17 19:16:58 +0000
@@ -359,10 +359,13 @@
                     return True
             return False
         badfiles = []
+        assert_re = re.compile(r'\bassert\b')
         for fname, text in self.get_source_file_contents():
             if not self.is_our_code(fname):
                 continue
-            ast = parser.ast2tuple(parser.suite(''.join(text)))
+            if not assert_re.search(text):
+                continue
+            ast = parser.ast2tuple(parser.suite(text))
             if search(ast):
                 badfiles.append(fname)
         if badfiles:




More information about the bazaar-commits mailing list