Hi, am trying to update the package on Fedora (see https://bugzilla.redhat.com/show_bug.cgi?id=590476 ) and I found that if I include the tests in the build process it fails, due to timezone dependant checks
ie, if I do the tests here (CET) they fail -- eg
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/tutorial.rst", line 241, in tutorial.rst
Failed example:
ephem.localtime(d)
Expected:
datetime.datetime(1984, 12, 21, 10, 0, 0, 4)
Got:
datetime.datetime(1984, 12, 21, 16, 0, 0, 4)
-- is there any way to 1) make the tests TZ independant? or 2) skip a set of tests?
Many thanks
Andrew
=== Full build fail extract ===
+ /usr/bin/python setup.py test
running test
running egg_info
writing src/pyephem.egg-info/PKG-INFO
writing top-level names to src/pyephem.egg-info/top_level.txt
writing dependency_links to src/pyephem.egg-info/dependency_links.txt
reading manifest file 'src/pyephem.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'src/pyephem.egg-info/SOURCES.txt'
running build_ext
copying build/lib.linux-x86_64-2.7/ephem/_libastro.so -> src/ephem
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/tutorial.rst
Doctest: tutorial.rst ... FAIL
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/reference.rst
Doctest: reference.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/newton.rst
Doctest: newton.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/angle.rst
Doctest: angle.rst ... FAIL
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/catalogs.rst
Doctest: catalogs.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/examples.rst
Doctest: examples.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/coordinates.rst
Doctest: coordinates.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/CHANGELOG.rst
Doctest: CHANGELOG.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/rise-set.rst
Doctest: rise-set.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/faq.rst
Doctest: faq.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/radec.rst
Doctest: radec.rst ... ok
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/quick.rst
Doctest: quick.rst ... FAIL
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/date.rst
Doctest: date.rst ... FAIL
test_next_pass (ephem.tests.test_satellite.Case) ... ok
test_normal_methods (ephem.tests.test_satellite.Case) ... ok
test_usno (ephem.tests.test_usno.T1) ... ok
test_usno (ephem.tests.test_usno.T10) ... ok
test_usno (ephem.tests.test_usno.T11) ... ok
test_usno (ephem.tests.test_usno.T12) ... ok
test_usno (ephem.tests.test_usno.T13) ... ok
test_usno (ephem.tests.test_usno.T14) ... ok
test_usno (ephem.tests.test_usno.T15) ... ok
test_usno (ephem.tests.test_usno.T2) ... ok
test_usno (ephem.tests.test_usno.T3) ... ok
test_usno (ephem.tests.test_usno.T4) ... ok
test_usno (ephem.tests.test_usno.T5) ... ok
test_usno (ephem.tests.test_usno.T6) ... ok
test_usno (ephem.tests.test_usno.T7) ... ok
test_usno (ephem.tests.test_usno.T8) ... ok
test_usno (ephem.tests.test_usno.T9) ... ok
test_date_constructor (ephem.tests.test_dates.date_suite) ... ok
test_date_string_value (ephem.tests.test_dates.date_suite) ... ok
test_date_triple_value (ephem.tests.test_dates.date_suite) ... ok
test_date_tuple_value (ephem.tests.test_dates.date_suite) ... ok
test_localtime_modern (ephem.tests.test_dates.date_suite) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
runTest (ephem.tests.test_jpl.JPLTest) ... ok
test_Angle_constructor (ephem.tests.test_angles.angle_suite) ... ok
test_angle_addition (ephem.tests.test_angles.angle_suite) ... ok
test_angle_subtraction (ephem.tests.test_angles.angle_suite) ... ok
test_degrees_constructor (ephem.tests.test_angles.angle_suite) ... ok
test_degrees_float_value (ephem.tests.test_angles.angle_suite) ... ok
test_degrees_string_value (ephem.tests.test_angles.angle_suite) ... ok
test_hours_constructor (ephem.tests.test_angles.angle_suite) ... ok
test_hours_float_value (ephem.tests.test_angles.angle_suite) ... ok
test_hours_string_value (ephem.tests.test_angles.angle_suite) ... ok
test_equinoxes (ephem.tests.test_usno_equinoxes.usno_equinoxes_suite) ... ok
test_lon_can_also_be_called_long (ephem.tests.test_observers.observer_suite) ... ok
test_pressure_at_11km (ephem.tests.test_observers.observer_suite) ... ok
test_pressure_at_sea_level (ephem.tests.test_observers.observer_suite) ... ok
test_constants (ephem.tests.test_constants.constant_suite) ... ok
test_boston (ephem.tests.test_cities.CityTests) ... ok
test_unknown_city (ephem.tests.test_cities.CityTests) ... ok
test_Fomalhaut (ephem.tests.test_stars.StarTests) ... ok
test_Fomalhaut_autocompute (ephem.tests.test_stars.StarTests) ... ok
test_Fomalhaut_compute (ephem.tests.test_stars.StarTests) ... ok
test_unknown_star (ephem.tests.test_stars.StarTests) ... ok
test_EarthSatellite (ephem.tests.test_bodies.body_suite) ... ok
test_EllipticalBody (ephem.tests.test_bodies.body_suite) ... ok
test_FixedBody (ephem.tests.test_bodies.body_suite) ... ok
test_HyperbolicBody (ephem.tests.test_bodies.body_suite) ... ok
test_Named (ephem.tests.test_bodies.body_suite) ... ok
test_ParabolicBody (ephem.tests.test_bodies.body_suite) ... ok
test_newlineTLE (ephem.tests.test_bodies.body_suite)
Make sure TLE strings with newlines are accepted. ... ok
test_constellation (ephem.tests.test_bodies.function_suite) ... /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/test_bodies.py:275: DeprecationWarning: PyOS_ascii_strtod and PyOS_ascii_atof are deprecated. Use PyOS_string_to_double instead.
oneb = readdb('Orion Nebula,f,5.59,-5.45,2,2000.0,')
/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/test_bodies.py:276: DeprecationWarning: PyOS_ascii_strtod and PyOS_ascii_atof are deprecated. Use PyOS_string_to_double instead.
oneb.compute('1999/2/28')
ok
test_jupiter (ephem.tests.test_bodies.planet_suite) ... /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/test_bodies.py:260: DeprecationWarning: PyOS_ascii_strtod and PyOS_ascii_atof are deprecated. Use PyOS_string_to_double instead.
j = Jupiter('2008/10/1')
ok
test_saturn (ephem.tests.test_bodies.planet_suite) ... /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/test_bodies.py:266: DeprecationWarning: PyOS_ascii_strtod and PyOS_ascii_atof are deprecated. Use PyOS_string_to_double instead.
s = Saturn('2008/10/1')
ok
runTest (ephem.tests.launchpad_236872.convergence_suite) ... /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/launchpad_236872.py:13: DeprecationWarning: PyOS_ascii_strtod and PyOS_ascii_atof are deprecated. Use PyOS_string_to_double instead.
boston.date = ephem.Date('2008/5/29 15:59:16')
ok
runTest (ephem.tests.launchpad_244811.next_rising_suite) ... /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/launchpad_244811.py:15: DeprecationWarning: PyOS_ascii_strtod and PyOS_ascii_atof are deprecated. Use PyOS_string_to_double instead.
cur_date = ephem.Date("2009/6/29 07:00:00")
ok
======================================================================
FAIL: /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/tutorial.rst
Doctest: tutorial.rst
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib64/python2.7/doctest.py", line 2153, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for tutorial.rst
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/tutorial.rst", line 0
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/tutorial.rst", line 241, in tutorial.rst
Failed example:
ephem.localtime(d)
Expected:
datetime.datetime(1984, 12, 21, 10, 0, 0, 4)
Got:
datetime.datetime(1984, 12, 21, 16, 0, 0, 4)
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/tutorial.rst", line 243, in tutorial.rst
Failed example:
print ephem.localtime(d).ctime()
Expected:
Fri Dec 21 10:00:00 1984
Got:
Fri Dec 21 16:00:00 1984
======================================================================
FAIL: /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/angle.rst
Doctest: angle.rst
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib64/python2.7/doctest.py", line 2153, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for angle.rst
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/angle.rst", line 0
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/angle.rst", line 20, in angle.rst
Failed example:
print repr(j.dec)
Expected:
-0.21219402907146165
Got:
-0.21219402907146148
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/angle.rst", line 30, in angle.rst
Failed example:
print repr(j.ra)
Expected:
3.7208800741071806
Got:
3.720880074107181
======================================================================
FAIL: /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/quick.rst
Doctest: quick.rst
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib64/python2.7/doctest.py", line 2153, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for quick.rst
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/quick.rst", line 0
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/quick.rst", line 791, in quick.rst
Failed example:
ephem.localtime(d)
Expected:
datetime.datetime(1997, 3, 9, 0, 13, 0, 6)
Got:
datetime.datetime(1997, 3, 9, 6, 13, 0, 6)
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/quick.rst", line 793, in quick.rst
Failed example:
print ephem.localtime(d)
Expected:
1997-03-09 00:13:00.000006
Got:
1997-03-09 06:13:00.000006
======================================================================
FAIL: /home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/date.rst
Doctest: date.rst
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib64/python2.7/doctest.py", line 2153, in runTest
raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for date.rst
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/date.rst", line 0
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/date.rst", line 48, in date.rst
Failed example:
print lt
Expected:
1984-05-30 12:23:45.000002
Got:
1984-05-30 18:23:45.000002
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/date.rst", line 50, in date.rst
Failed example:
print repr(lt)
Expected:
datetime.datetime(1984, 5, 30, 12, 23, 45, 2)
Got:
datetime.datetime(1984, 5, 30, 18, 23, 45, 2)
----------------------------------------------------------------------
File "/home/aelwell/rpmbuild/BUILD/pyephem-3.7.4.1/src/ephem/tests/../doc/date.rst", line 103, in date.rst
Failed example:
print ephem.Date(datetime(2005, 4, 18, 22, 15))
Expected:
2005/4/18 22:15:00
Got:
2005/4/18 22:14:59
----------------------------------------------------------------------
Ran 77 tests in 5.288s
FAILED (failures=4)
error: Bad exit status from /var/tmp/rpm-tmp.NwA7Ra (%check)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.NwA7Ra (%check)
-- full log pasted below.
I have just committed a fix that disables the example doctest expressions that are sensitive to time zone; are you able to pull the code from Bitbucket and see whether your issue is now resolved?
Also, note that I have moved from the non-standard setuptools "test" mechanism to supporting the "unittest2" approach that is now standard with Python 2.7; see the INSTALL docs for details. Let me know if there is anything else I can do to help make packaging easier for you!