Rev 4576: Support python 2.4. in http://bazaar.launchpad.net/~lifeless/bzr/test_progress

Robert Collins robertc at robertcollins.net
Mon Aug 3 04:44:37 BST 2009


At http://bazaar.launchpad.net/~lifeless/bzr/test_progress

------------------------------------------------------------
revno: 4576
revision-id: robertc at robertcollins.net-20090803034432-md3ds838h9rqazqy
parent: robertc at robertcollins.net-20090803015707-iyph5fw4na3oyw62
committer: Robert Collins <robertc at robertcollins.net>
branch nick: test_progress
timestamp: Mon 2009-08-03 13:44:32 +1000
message:
  Support python 2.4.
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-07-28 21:49:59 +0000
+++ b/bzrlib/tests/__init__.py	2009-08-03 03:44:32 +0000
@@ -113,6 +113,10 @@
 
 default_transport = LocalURLServer
 
+# Subunit result codes, defined here to prevent a hard dependency on subunit.
+SUBUNIT_SEEK_SET = 0
+SUBUNIT_SEEK_CUR = 1
+
 
 class ExtendedTestResult(unittest._TextTestResult):
     """Accepts, reports and accumulates the results of running tests.
@@ -360,9 +364,9 @@
 
     def progress(self, offset, whence):
         """The test is adjusting the count of tests to run."""
-        if whence == os.SEEK_SET:
+        if whence == SUBUNIT_SEEK_SET:
             self.num_tests = offset
-        elif whence == os.SEEK_CUR:
+        elif whence == SUBUNIT_SEEK_CUR:
             self.num_tests += offset
         else:
             raise errors.BzrError("Unknown whence %r" % whence)
@@ -2875,7 +2879,7 @@
     def run(self, result):
         progress_method = getattr(result, 'progress', None)
         if callable(progress_method):
-            progress_method(self.countTestCases(), os.SEEK_SET)
+            progress_method(self.countTestCases(), SUBUNIT_SEEK_SET)
         return super(CountingDecorator, self).run(result)
 
 




More information about the bazaar-commits mailing list