Opened 9 years ago
Closed 9 years ago
#12530 closed defect (cantfix)
Test failures in trac.util.tests.datefmt.PytzTestCase
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | general | Version: | 1.0.11 |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
See two test failures:
======================================================================
ERROR: test_posix_conversion (trac.util.tests.datefmt.PytzTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/portage/www-apps/trac-1.0.11/work/Trac-1.0.11/trac/util/tests/datefmt.py", line 45, in test_posix_conversion
tz.utcoffset(None))
AttributeError: 'NoneType' object has no attribute 'utcoffset'
======================================================================
ERROR: test_unicode_input (trac.util.tests.datefmt.PytzTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/portage/www-apps/trac-1.0.11/work/Trac-1.0.11/trac/util/tests/datefmt.py", line 51, in test_unicode_input
tz.utcoffset(None))
AttributeError: 'NoneType' object has no attribute 'utcoffset'
----------------------------------------------------------------------
I see them with both 1.0.12 and 1.0.11, but I feel confident I didn't see them with 1.0.11 before (probably around the time it was released).
Attachments (0)
Change History (9)
comment:1 by , 9 years ago
| Milestone: | 1.0.13 |
|---|---|
| Resolution: | → worksforme |
| Status: | new → closed |
comment:2 by , 9 years ago
| Version: | 1.0.12 → 1.0.11 |
|---|
comment:3 by , 9 years ago
Your installed pytz package is weird. Etc/GMT-4 timezone in pytz is used in those unit cases of 2 failures however it failed to load the timezone. It seems your pytz package doesn't have the timezone.
$ virtualenv /dev/shm/pytz-2016.3
New python executable in /dev/shm/pytz-2016.3/bin/python
Installing setuptools, pip...done.
$ /dev/shm/pytz-2016.3/bin/pip install pytz==2016.3
Downloading/unpacking pytz==2016.3
Downloading pytz-2016.3-py2.py3-none-any.whl (479kB): 479kB downloaded
Storing download in cache at /home/jun66j5/arc/pip/https%3A%2F%2Fpypi.python.org%2Fpackages%2Fe2%2F87%2Fe774b15dd6468889e5268ebbc00040c9f9da546c462099c4d43e14697e04%2Fpytz-2016.3-py2.py3-none-any.whl
Installing collected packages: pytz
Successfully installed pytz
Cleaning up...
$ /dev/shm/pytz-2016.3/bin/python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytz
>>> pytz.timezone('Etc/GMT-4')
<StaticTzInfo 'Etc/GMT-4'>
comment:4 by , 9 years ago
Seems to work fine for me:
djc@enrai pytz $ python
Python 2.7.10 (default, Apr 29 2016, 11:30:30)
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytz
>>> pytz.timezone('Etc/GMT-4')
<DstTzInfo 'Etc/GMT-4' GMT-4+4:00:00 STD>
>>>
Environment is Python 2.7.10 running on Gentoo Linux, pytz-2015.6.
comment:5 by , 9 years ago
I investigate with Gentoo on docker. StaticTzInfo class is used for Etc/GMT-4 however DstTzInfo is used on your environment. Etc/GMT-4 must be static timezone, not DST timezone. I consider your pytz is broken.
9d523f07b63e / # equery list pytz
* Searching for pytz ...
[IP-] [ ] dev-python/pytz-2015.6:0
9d523f07b63e / # python
Python 2.7.10 (default, Jul 9 2016, 11:05:08)
[GCC 4.9.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytz
>>> pytz.__version__
'2015.6'
>>> pytz.timezone('Etc/GMT-4')
<StaticTzInfo 'Etc/GMT-4'>
comment:6 by , 9 years ago
| Resolution: | worksforme → cantfix |
|---|
I confirmed tests of trac-1.0.11.ebuild pass. Please report to package maintainers if you cannot fix your environment.
9d523f07b63e / # ebuild /usr/portage/www-apps/trac/trac-1.0.11.ebuild test Forcing test. >>> Downloading 'http://distfiles.gentoo.org/distfiles/Trac-1.0.11.tar.gz' ... >>> Source compiled. >>> Test phase: www-apps/trac-1.0.11 SKIP: fine-grained permission tests (ConfigObj not installed) SKIP: utils/tests/datefmt.py (no babel installed) SKIP: trac.versioncontrol.web_ui.tests.browser.BrowserModulePermissionsTestCase (no configobj installed) SKIP: tracopt/mimeview/tests/php.py (php cli binary, 'php', not found) SKIP: tracopt/perm/tests/authz_policy.py (no configobj installed) SKIP: tracopt/versioncontrol/git/tests/PyGIT.py (git cli binary, 'git', not found) SKIP: tracopt/versioncontrol/git/tests/git_fs.py (git cli binary, 'git', not found) SKIP: tracopt/versioncontrol/svn/tests/svn_fs.py (no svn bindings) SKIP: functional tests (Twill not installed) ............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... ---------------------------------------------------------------------- Ran 1551 tests in 74.074s OK >>> Completed testing www-apps/trac-1.0.11
comment:7 by , 9 years ago
| Milestone: | → 1.0.13 |
|---|---|
| Resolution: | cantfix |
| Status: | closed → reopened |
Reproduced it with pytz 2016.6 (it seems the version is released on 2016-07-13):
>>> import pytz
>>> pytz.__version__
'2016.6'
>>> tz = pytz.timezone('Etc/GMT-4')
>>> tz
<DstTzInfo 'Etc/GMT-4' GMT-4+4:00:00 STD>
>>> tz.utcoffset(None) is None
True
This issue is filed in https://bugs.launchpad.net/pytz/+bug/1602807.
Workaround is to downgrade to pytz 2016.4.
comment:8 by , 9 years ago
The pytz issue has been fixed and pytz 2016.6.1 is released. See https://pypi.python.org/pypi/pytz/2016.6.1.
comment:9 by , 9 years ago
| Milestone: | 1.0.13 |
|---|---|
| Resolution: | → cantfix |
| Status: | reopened → closed |
The dev-python/pytz in Gentoo is bumped up to 2016.6.1. Closing again.



Works for me. Unit test in Trac 1.0.11 pass. Please post the details of your environment if reproduced.
$ curl -s https://download.edgewall.org/trac/Trac-1.0.11.tar.gz | tar xzf - -C /dev/shm $ cd /dev/shm/Trac-1.0.11 $ make python=27-1.0 clean Trac.egg-info unit-test find . -name \*.py[co] -exec rm {} \; rm -f .figleaf* *.figleaf rm -fr figleaf coverage erase rm -fr build/doc Python: /home/jun66j5/venv/py27-1.0/bin/python Package Version ------------------------------------------------------------------ Python : 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] Setuptools : 2.2 Genshi : 0.7 Babel : 2.3.4 sqlite3 : 2.6.0 (3.8.2) PySqlite : 2.8.2 (3.8.2) MySQLdb : 1.2.5 Psycopg2 : 2.6.1 (dt dec pq3 ext lo64) SVN bindings : 1.8.8 (r1568071) Mercurial : 3.8.4 Pygments : 2.1.3 Textile : not installed Pytz : 2016.4 ConfigObj : 5.0.6 Docutils : 0.12 Twill : 0.9 LXML : 3.6.0 coverage : 4.1 figleaf : not installed Variables: PATH=/home/jun66j5/venv/py27-1.0/bin::$PATH PYTHONPATH=.::$PYTHONPATH TRAC_TEST_DB_URI= server-options= -p 3000 -a '*,/home/jun66j5/src/trac-htdigest.txt,auth' -e External dependencies: Git version: git version 1.9.1 python setup.py egg_info running egg_info writing dependency_links to Trac.egg-info/dependency_links.txt writing requirements to Trac.egg-info/requires.txt writing Trac.egg-info/PKG-INFO writing top-level names to Trac.egg-info/top_level.txt writing entry points to Trac.egg-info/entry_points.txt reading manifest file 'Trac.egg-info/SOURCES.txt' writing manifest file 'Trac.egg-info/SOURCES.txt' python ./trac/test.py --skip-functional-tests ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ ---------------------------------------------------------------------- Ran 1840 tests in 30.263s OKSee also https://travis-ci.org/edgewall/trac/branches.