fedora-infra/datanommer

datanommer.commands test does not pass in Python 3

Closed this issue · 2 comments

ari3s commented

There is a Python 3 compatibility issue related to json_object in datanommer.commands:

[datanommer.commands]$ python3 setup.py test
running test
Searching for datanommer.models
Best match: datanommer.models 0.9.0
Processing datanommer.models-0.9.0-py3.6.egg
...

======================================================================
ERROR: test_latest (test_commands.TestCommands)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jberan/git/datanommer/datanommer.commands/tests/test_commands.py", line 812, in test_latest
    eq_(json_object[0]['git']['msg'], 'Message 3')
KeyError: 'git'

======================================================================
FAIL: test_latest_timesince (test_commands.TestCommands)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jberan/git/datanommer/datanommer.commands/.eggs/freezegun-0.3.9-py3.6.egg/freezegun/api.py", line 495, in wrapper
    result = func(*args, **kwargs)
  File "/home/jberan/git/datanommer/datanommer.commands/tests/test_commands.py", line 709, in test_latest_timesince
    assert int(json_object[0])<=1.1
AssertionError

======================================================================
FAIL: test_latest_timesince_human (test_commands.TestCommands)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jberan/git/datanommer/datanommer.commands/tests/test_commands.py", line 765, in test_latest_timesince_human
    assert_not_in('day', json_object[0])
AssertionError: 'day' unexpectedly found in '1 day, 0:00:00.046187'

======================================================================
FAIL: test_latest_timestamp (test_commands.TestCommands)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jberan/git/datanommer/datanommer.commands/.eggs/freezegun-0.3.9-py3.6.egg/freezegun/api.py", line 495, in wrapper
    result = func(*args, **kwargs)
  File "/home/jberan/git/datanommer/datanommer.commands/tests/test_commands.py", line 655, in test_latest_timestamp
    eq_(json_object[0], time.mktime(datetime(2013,2,16).timetuple()))
AssertionError: 1360882800.0 != 1360969200.0

======================================================================
FAIL: test_latest_timestamp_human (test_commands.TestCommands)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jberan/git/datanommer/datanommer.commands/.eggs/freezegun-0.3.9-py3.6.egg/freezegun/api.py", line 495, in wrapper
    result = func(*args, **kwargs)
  File "/home/jberan/git/datanommer/datanommer.commands/tests/test_commands.py", line 603, in test_latest_timestamp_human
    eq_(json_object[0], "2013-02-16 16:16:16.000016")
AssertionError: '2013-02-15 15:15:15.000015' != '2013-02-16 16:16:16.000016'

----------------------------------------------------------------------
Ran 15 tests in 0.992s

FAILED (failures=4, errors=1)
Test failed: <unittest.runner.TextTestResult run=15 errors=1 failures=4>
error: Test failed: <unittest.runner.TextTestResult run=15 errors=1 failures=4>

Should this issue be closed? The Travis CI tests seem to be passing.

Yeah, thanks @cclauss. :)