Edgewall Software

Opened 5 years ago

Closed 4 years ago

#12022 closed defect (fixed)

Test failure in datefmt module on OSX

Reported by: Ryan J Ollos Owned by: Jun Omae
Priority: normal Milestone: 1.0.11
Component: general Version:
Severity: normal Keywords: unit tests macosx
Cc: Branch:
Release Notes:

Skip several unit tests with Asia/Choibalsan between localtz and pytz.

API Changes:
Internal Changes:


FAIL: test_pytz_choibalsan (trac.util.tests.datefmt.LocalTimezoneTestCase)
Traceback (most recent call last):
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/util/tests/datefmt.py", line 1723, in test_pytz_choibalsan
    self._compare_pytz(tz, '1983-10-01T00:00')  # -1:00 (DST end)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/util/tests/datefmt.py", line 1711, in _compare_pytz
    self._compare_pytz_localize_and_normalize(tz, dt_naive)
  File "/Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/util/tests/datefmt.py", line 1688, in _compare_pytz_localize_and_normalize
    '%r != %r (%r)' % (dt_tz, dt_localtz, dt_naive))
AssertionError: datetime.datetime(1983, 9, 30, 22, 0, tzinfo=<DstTzInfo 'Asia/Choibalsan' CHOST+10:00:00 DST>) != datetime.datetime(1983, 9, 30, 22, 0, tzinfo=<LocalTimezone "UTC+09:00" 9:00:00>) (datetime.datetime(1983, 9, 30, 22, 0))


Attachments (0)

Change History (12)

comment:1 by Ryan J Ollos, 5 years ago

Could be unrelated to OSX, rather due to using a newer version of pytz. I haven't tested on any other platforms yet.

>>> import pytz
>>> pytz.__version__

The failing assertions are trunk/trac/util/tests/datefmt.py@12788:1723-1725#L1713, confirmed by commenting out the failing assertions so that other assertions in test case would be executed.

Last edited 5 years ago by Ryan J Ollos (previous) (diff)

comment:2 by Ryan J Ollos, 5 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:3 by Ryan J Ollos, 5 years ago

I haven't been able to reproduce on Windows 7 with pytz 2015.2, but the issue persists on OSX.

comment:4 by Ryan J Ollos, 5 years ago

Milestone: 1.0.6next-stable-1.0.x

comment:5 by Ryan J Ollos, 5 years ago

Owner: Ryan J Ollos removed
Status: assignednew

comment:6 by Ryan J Ollos, 5 years ago

Milestone: next-stable-1.0.x
Resolution: worksforme
Status: newclosed

After seeing this issue for months, I can no longer reproduce with either pytz 2015.2 or 2015.4. Maybe there was an update to OSX that fixed the issue? I'll reopen if the issue occurs again.

comment:7 by Jun Omae, 5 years ago

Milestone: next-stable-1.0.x
Resolution: worksforme
Status: closedreopened

Reproduced with Mac OS X build environment on Travis CI, while trying #12208. Perhaps, mktime in libc on Mac OS X doesn't have consistency…. I'll investigate it.

Last edited 4 years ago by Jun Omae (previous) (diff)

comment:8 by Jun Omae, 5 years ago

Owner: set to Jun Omae
Status: reopenedassigned

comment:9 by Jun Omae, 4 years ago

Milestone: next-stable-1.0.x1.0.11

After the patch, unit and functional tests pass on Mac OS X. See https://travis-ci.org/jun66j5/trac/builds/118786133.

  • trac/util/tests/datefmt.py

    diff --git a/trac/util/tests/datefmt.py b/trac/util/tests/datefmt.py
    index d01608ee4..0504e6d45 100644
    a b class LocalTimezoneTestCase(unittest.TestCase):  
    18171817            self._compare_pytz(tz, '1982-04-01T00:00')  # No DST
    18181818            self._compare_pytz(tz, '1983-04-01T00:00')  # +2:00 (TZ change)
    18191819            self._compare_pytz(tz, '1983-04-01T02:00')  #       (TZ change)
    1820             self._compare_pytz(tz, '1983-10-01T00:00')  # -1:00 (DST end)
     1820            self._compare_pytz(tz, '1983-10-01T00:00',  # -1:00 (DST end)
     1821                               localize=False)
    18211822            self._compare_pytz(tz, '2006-03-25T02:00')  # +1:00 (DST start)
    1822             self._compare_pytz(tz, '2006-09-30T02:00')  # -1:00 (DST end)
     1823            self._compare_pytz(tz, '2006-09-30T02:00',  # -1:00 (DST end)
     1824                               localize=False)
    18231825            self._compare_pytz(tz, '2007-07-01T00:00')  # No DST in 2007
    18241826            self._compare_pytz(tz, '2008-03-30T23:00',  #       (TZ change)
    18251827                               localize=False)

comment:10 by Ryan J Ollos, 4 years ago

Travis CI is currently using OSX 10.9.5. I don't recall the version of OSX that I was running when I discovered the issue, but I'm currently running 10.11.4 and I don't see the issue. I guess it's probably difficult to determine the exact version of OSX in which the issue is fixed.

Last edited 4 years ago by Ryan J Ollos (previous) (diff)

comment:11 by Jun Omae, 4 years ago

Thanks. I'm using OSX 10.10.5 (version of libSystem.dylib is 1213.0.0). This issue cannot be reproduced on my environment. The test cases isn't important. It's no problem to skip the cases.

$ sw_vers -productVersion
$ ls -l /usr/lib/libc.*
lrwxr-xr-x  1 root  wheel  15 Jun 26  2015 /usr/lib/libc.dylib -> libSystem.dylib
$ otool -L /usr/lib/libc.dylib | grep libSystem
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)

comment:12 by Jun Omae, 4 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [14678] and merged to trunk in [14679].

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.