IRC-SPHERE / HyperStream

HyperStream
https://irc-sphere.github.io/HyperStream/
MIT License
13 stars 5 forks source link

test_data_importers fails on travis python 3.6.1 only #21

Open tdiethe opened 7 years ago

tdiethe commented 7 years ago

See e.g. here

Logging output:

======================================================================
FAIL: test_data_importers (tests.test_tools.TestTools)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/IRC-SPHERE/HyperStream/tests/test_tools.py", line 388, in test_data_importers
    assert_all_close(sea_ice_sums.window().values(), list(map(sum, sea_ice.window().values())), 1e-5)
  File "/home/travis/build/IRC-SPHERE/HyperStream/tests/helpers.py", line 203, in assert_all_close
    .format(i, x, y, prec=prec))
AssertionError: Elements not equal at location 0. a = 15.48000, b = 0.00000
-------------------- >> begin captured logging << --------------------
root: DEBUG: creating session: [uuid=49c40ada-726b-11e7-a3c3-42010a0a140e]
root: DEBUG: Defining a CsvReader tool with parameters {'filename': 'plugins/data_importers/data/sea_ice.csv'}
root: DEBUG: creating sea_ice
root: DEBUG: creating sea_ice_sums
root: DEBUG: Defining a ListSum tool
root: DEBUG: set calculated intervals
--------------------- >> end captured logging << ---------------------

Can't really understand why b = 0.00000 there. The same test runs fine on OS-X also with python 3.6.1. For now I've commented the offending line (last line of test)

Contents of the test:

    def test_data_importers(self):
        with HyperStream(file_logger=False, console_logger=False, mqtt_logger=None) as hs:
            reader = hs.plugins.data_importers.tools.csv_reader('plugins/data_importers/data/sea_ice.csv')
            # noinspection PyTypeChecker
            ti = TimeInterval(datetime(1990, 1, 1).replace(tzinfo=UTC), datetime(2011, 4, 1).replace(tzinfo=UTC))

            # TODO: More complicated tests, including headers, different delimiters, messy data etc etc.
            sea_ice = hs.channel_manager.memory.get_or_create_stream("sea_ice")

            reader.execute(sources=[], sink=sea_ice, interval=ti)

            sea_ice_sums = hs.channel_manager.mongo.get_or_create_stream("sea_ice_sums")
            hs.tools.list_sum().execute(sources=[sea_ice], sink=sea_ice_sums, interval=ti)

            # print(sea_ice_sums.window().values())

            # TODO: the below assertion is causing travis to fail - why?
            assert_all_close(sea_ice_sums.window().values(), list(map(sum, sea_ice.window().values())), 1e-5)