[BUG] changeset test suite fails unpredictably

Aaron Bentley aaron.bentley at utoronto.ca
Thu Jul 21 02:08:43 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

The changeset test suite uses random numbers to test the
unpack_hires_date function.  These numbers are sometimes out of range of
time_t, and sometimes not.  As a result, the test suite sometimes fails,
and sometimes passes.

Aaron


bzrlib.plugin.bzr-changeset.common.unpack_highres_date       FAILURE
- ------------------------------------------------------------
unpack_highres_date (bzrlib.plugin.bzr-changeset.common)
   (Doctest: bzrlib.plugin.bzr-changeset.common.unpack_highres_date)
Traceback (most recent call last):
  File "/usr/lib/python2.4/unittest.py", line 260, in run
    testMethod()
  File "/usr/lib/python2.4/doctest.py", line 2152, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
bzrlib.plugin.bzr-changeset.common.unpack_highres_date
  File "/home/abentley/.bzr.conf/plugins/bzr-changeset/common.py", line
185, in unpack_highres_date

- ----------------------------------------------------------------------
File "/home/abentley/.bzr.conf/plugins/bzr-changeset/common.py", line
209, in bzrlib.plugin.bzr-changeset.common.unpack_highres_date
Failed example:
    for count in xrange(500):
      t += random.random()*24*3600*365*2 - 24*3600*364 # Random time
within +/- 1 year
      o = random.randint(-12,12)*3600 # Random timezone
      date = format_highres_date(t, o)
      t2, o2 = unpack_highres_date(date)
      if t != t2 or o != o2:
         print 'Failed on date %r, %s,%s diff:%s' % (date, t, o, t2-t)
         break
Exception raised:
    Traceback (most recent call last):
      File "/usr/lib/python2.4/doctest.py", line 1243, in __run
        compileflags, 1) in test.globs
      File "<doctest
bzrlib.plugin.bzr-changeset.common.unpack_highres_date[10]>", line 4, in ?
      File "/home/abentley/.bzr.conf/plugins/bzr-changeset/common.py",
line 179, in format_highres_date
        tt = time.gmtime(t + offset)
    ValueError: timestamp out of range for platform time_t

- ------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC3vWb0F+nu1YWqI0RAgPDAJ9sTdTciWxP+1f9059/EKusMpMBvACfStqE
BwC3Knr0JhbNzQzjqZoOoB8=
=hU2f
-----END PGP SIGNATURE-----




More information about the bazaar mailing list