[Python-Dev] Vacation and possibly a new bug

Kurt B. Kaiser kbk@shore.net
Tue, 22 Jul 2003 17:25:25 -0400


Michael Hudson <mwh@python.net> writes:

> Well, test_time fails for me on the starship seeminly no matter waht I
> do (i.e. just check out from CVS or apply either of the patches
> mentioned in the report).  This may be pilot error.

Redhat 6.0 +
libc.so.6 2.1.3
autoconf 2.53


Using 2.3c1, no patch:

test_time
test test_time failed -- Traceback (most recent call last):
  File "/home/kbk/PYTHON/python/dist/src/Lib/test/test_time.py", line 107, in test_tzset
    self.failUnless(time.tzname[1] == 'AEDT', str(time.tzname[1]))
  File "/home/kbk/PYTHON/python/dist/src/Lib/unittest.py", line 268, in failUnless
    if not expr: raise self.failureException, msg
AssertionError: AEST

======================
Apply patch 55665: tzset_AEST.diff 2003-7-12 18:01 bcannon:



===========================
What have I done??


Index: configure.in
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure.in,v
retrieving revision 1.425
diff -c -c -p -r1.425 configure.in
*** configure.in	13 Jul 2003 09:46:13 -0000	1.425
--- configure.in	22 Jul 2003 21:18:33 -0000
*************** AC_CACHE_VAL(ac_cv_working_tzset, [
*** 2775,2794 ****
  AC_TRY_RUN([
  #include <stdlib.h>
  #include <time.h>
  int main()
  {
! 	int gmt_hour;
! 	int eastern_hour;
! 	time_t now;
! 	now = time((time_t*)NULL);
  	putenv("TZ=UTC+0");
  	tzset();
! 	gmt_hour = localtime(&now)->tm_hour;
  	putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
  	tzset();
! 	eastern_hour = localtime(&now)->tm_hour;
! 	if (eastern_hour == gmt_hour)
  	    exit(1);
  	exit(0);
  }
  ],
--- 2775,2805 ----
  AC_TRY_RUN([
  #include <stdlib.h>
  #include <time.h>
+ #include <string.h>
  int main()
  {
! 	/* Note that we need to ensure that not only does tzset(3)
! 	   do 'something' with localtime, but it works as documented
! 	   in the library reference and as expected by the test suite. */
! 	time_t xmas = 1040774400; /* GMT-based */
! 
  	putenv("TZ=UTC+0");
  	tzset();
! 	if (localtime(&xmas)->tm_hour != 0)
! 	    exit(1);
! 
  	putenv("TZ=EST+5EDT,M4.1.0,M10.5.0");
  	tzset();
! 	if (localtime(&xmas)->tm_hour != 19)
! 	    exit(1);
! 
! 	putenv("TZ=AEST-10AEDT-11,M10.5.0,M3.5.0");
! 	tzset();
! 	if (localtime(&xmas)->tm_hour != 11)
  	    exit(1);
+         if (strcmp(localtime(&xmas)->tm_zone, "AEDT"))
+             exit(1);
+ 
  	exit(0);
  }
  ],

===========================
./configure
make

===========================
Run the test:


[kbk@float ~/PYSRC]$ python2.3 -c "from test import test_time;
> test_time.test_main()"
test_asctime (test.test_time.TimeTestCase) ... ok
test_clock (test.test_time.TimeTestCase) ... ok
test_conversions (test.test_time.TimeTestCase) ... ok
test_data_attributes (test.test_time.TimeTestCase) ... ok
test_sleep (test.test_time.TimeTestCase) ... ok
test_strftime (test.test_time.TimeTestCase) ... ok
test_strptime (test.test_time.TimeTestCase) ... ok
test_tzset (test.test_time.TimeTestCase) ... FAIL

======================================================================
FAIL: test_tzset (test.test_time.TimeTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python2.3/test/test_time.py", line 107, in test_tzset
    self.failUnless(time.tzname[1] == 'AEDT', str(time.tzname[1]))
  File "/usr/local/lib/python2.3/unittest.py", line 268, in failUnless
    if not expr: raise self.failureException, msg
AssertionError: AEST

----------------------------------------------------------------------
Ran 8 tests in 2.254s

FAILED (failures=1)
Traceback (most recent call last):
  File "<string>", line 2, in ?
  File "/usr/local/lib/python2.3/test/test_time.py", line 125, in test_main
    test_support.run_unittest(TimeTestCase)
  File "/usr/local/lib/python2.3/test/test_support.py", line 259, in run_unittest
    run_suite(suite, testclass)
  File "/usr/local/lib/python2.3/test/test_support.py", line 247, in run_suite
    raise TestFailed(err)
test.test_support.TestFailed: Traceback (most recent call last):
  File "/usr/local/lib/python2.3/test/test_time.py", line 107, in test_tzset
    self.failUnless(time.tzname[1] == 'AEDT', str(time.tzname[1]))
  File "/usr/local/lib/python2.3/unittest.py", line 268, in failUnless
    if not expr: raise self.failureException, msg
AssertionError: AEST

-- 
KBK