PQM: test failure

John Arbash Meinel john at arbash-meinel.com
Mon Apr 2 15:38:22 BST 2007


Olexandr Byelchenko wrote:
> ======================================================================
> 
> FAIL: test_known_failure_ok_run (bzrlib.tests.test_selftest.TestRunner)
...

> 
> I think it's a very bad style to make test depends on time intervals.
> 
> [µ]
> 
> 

I don't think it was meant to be dependent on time interval. So we could
instead use:
        self.assertContainsRe(stream.getvalue(),
            '\n'
            '-*\n'
            'Ran 1 test in 0.0\\d\\ds\n'
            '\n'
            'OK \\(known_failures=1\\)\n')

It works for me, at least.
(the \\ are a little ugly, but necessary since we need \n)

=== modified file 'bzrlib/tests/test_selftest.py'
--- bzrlib/tests/test_selftest.py       2007-03-28 07:33:07 +0000
+++ bzrlib/tests/test_selftest.py       2007-04-02 13:55:55 +0000
@@ -932,13 +932,12 @@
         stream = StringIO()
         runner = TextTestRunner(stream=stream)
         result = self.run_test_runner(runner, test)
-        self.assertEqual(
-            '\n'
-
'----------------------------------------------------------------------\n'
-            'Ran 1 test in 0.000s\n'
-            '\n'
-            'OK (known_failures=1)\n',
-            stream.getvalue())
+        self.assertContainsRe(stream.getvalue(),
+            '\n'
+            '-*\n'
+            'Ran 1 test in 0.0\\d\\ds\n'
+            '\n'
+            'OK \\(known_failures=1\\)\n')

     def test_skipped_test(self):
         # run a test that is skipped, and check the suite as a whole still

John
=:->

PS> If you +1 this, I'll submit it.



More information about the bazaar mailing list