Rev 4575: os.SEEK_SET isn't available on python 2.4, duplicate the constant for subunit support. in http://people.canonical.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Thu Jul 30 01:01:25 BST 2009


At http://people.canonical.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 4575
revision-id: robertc at robertcollins.net-20090730000122-n7xn00mhwds9bs5c
parent: robertc at robertcollins.net-20090728214959-z0z01q2m47phmkcw
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Thu 2009-07-30 10:01:22 +1000
message:
  os.SEEK_SET isn't available on python 2.4, duplicate the constant for subunit support.
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-07-28 21:49:59 +0000
+++ b/bzrlib/tests/__init__.py	2009-07-30 00:01:22 +0000
@@ -113,6 +113,11 @@
 
 default_transport = LocalURLServer
 
+# Constants for integrating with subunit; duplicated here to avoid having a
+# hard dependency on subunit.
+SUBUNIT_SET = 0
+SUBUNIT_CUR = 1
+
 
 class ExtendedTestResult(unittest._TextTestResult):
     """Accepts, reports and accumulates the results of running tests.
@@ -360,9 +365,9 @@
 
     def progress(self, offset, whence):
         """The test is adjusting the count of tests to run."""
-        if whence == os.SEEK_SET:
+        if whence == SUBUNIT_SET:
             self.num_tests = offset
-        elif whence == os.SEEK_CUR:
+        elif whence == SUBUNIT_CUR:
             self.num_tests += offset
         else:
             raise errors.BzrError("Unknown whence %r" % whence)
@@ -2875,7 +2880,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_SET)
         return super(CountingDecorator, self).run(result)
 
 




More information about the bazaar-commits mailing list