[Python-modules-team] Bug#842448: webhelpers: FTBFS the day it happens a time change (webhelpers.date.distance_of_time_in_words fails)

Santiago Vila sanvila at debian.org
Sat Oct 29 10:46:57 UTC 2016


Package: src:webhelpers
Version: 1.3-4
Severity: important
Tags: patch

Hello Piotr.

I tried to build this package in stretch with "dpkg-buildpackage -A"
(which is what the "Arch: all" autobuilder would do to build it)
but it failed:

--------------------------------------------------------------------------------
[...]
 debian/rules build-indep
make: Nothing to be done for 'build-indep'.
 fakeroot debian/rules binary-indep
dh_testdir
dh_testroot
dh_prep
dh_installdirs
dh_installdirs: Compatibility levels before 9 are deprecated (level 5 in use)
python setup.py install \
	--no-compile \
	--single-version-externally-managed \
	--root /<<PKGBUILDDIR>>/debian/python-webhelpers --install-layout=deb
running install

[... snipped ...]

test_button_to_with_method_get (test_tools.TestURLHelper) ... ok
test_button_to_with_query (test_tools.TestURLHelper) ... ok
test_button_to_with_query_and_no_name (test_tools.TestURLHelper) ... ok
test_button_to_with_straight_url (test_tools.TestURLHelper) ... ok
test_environ (test_tools.TestURLHelper) ... ok
test_mail_to (test_tools.TestURLHelper) ... ok
test_mail_to_with_hex (test_tools.TestURLHelper) ... ok
test_mail_to_with_img (test_tools.TestURLHelper) ... ok
test_mail_to_with_javascript (test_tools.TestURLHelper) ... ok
test_mail_to_with_options (test_tools.TestURLHelper) ... ok
test_mail_to_with_replace_options (test_tools.TestURLHelper) ... ok
test_environ (test_tools.WebHelpersTestCase) ... ok

======================================================================
FAIL: Doctest: webhelpers.date.distance_of_time_in_words
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/doctest.py", line 2226, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for webhelpers.date.distance_of_time_in_words
  File "/<<PKGBUILDDIR>>/webhelpers/date.py", line 39, in distance_of_time_in_words

----------------------------------------------------------------------
File "/<<PKGBUILDDIR>>/webhelpers/date.py", line 62, in webhelpers.date.distance_of_time_in_words
Failed example:
    distance_of_time_in_words(86399)
Expected:
    '23 hours, 59 minutes and 59 seconds'
Got:
    '22 hours, 59 minutes and 59 seconds'


======================================================================
FAIL: test_distance_of_time_in_words (test_date.TestDateHelper)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/tests/test_date.py", line 57, in test_distance_of_time_in_words
    self.assertEqual("1 day and 5 minutes", distance_of_time_in_words(86689, round=True, granularity='minute'))
AssertionError: '1 day and 5 minutes' != '23 hours and 5 minutes'

----------------------------------------------------------------------
Ran 252 tests in 0.847s

FAILED (failures=2)
debian/rules:27: recipe for target 'test-python2.7' failed
make: *** [test-python2.7] Error 1
dpkg-buildpackage: error: fakeroot debian/rules binary-indep gave error exit status 2
--------------------------------------------------------------------------------

This happens because we are leaving Summer Time this night in Europe,
in less than 24 hours.

To reproduce, please try something like this:

TZ=Europe/Warsaw faketime "2016-10-29 02:30 UTC" dpkg-buildpackage -uc -us -A


One way to fix this would be to modify debian/patches/disabled_tests.patch
and disable the tests which fail today as well.

A more simple way is the patch below.


If you forward this upstream, I would also recommend the author to read
"Falsehoods programmers believe about time":

http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time


[ Note: I would report this as "serious" because it's a FTBFS, but official
  autobuilders use TZ=Etc/UTC, so I understand this will never ever
  happen in buildd.debian.org ].


Thanks.

--- a/debian/rules
+++ b/debian/rules
@@ -26,7 +26,7 @@ test: $(PYVERS:%=test-python%)
 test-python%:
 	-
 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
-	python$* setup.py nosetests
+	TZ=Etc/UTC python$* setup.py nosetests
 endif
 
 install:



More information about the Python-modules-team mailing list