csparpa / pyowm

A Python wrapper around the OpenWeatherMap web API
https://pyowm.readthedocs.io
MIT License
789 stars 169 forks source link

Understand why some tests fail on Travis CI but pass locally #397

Open csparpa opened 2 years ago

csparpa commented 2 years ago

Unit tests failing on Travis CI: https://app.travis-ci.com/github/csparpa/pyowm/builds/249771377

Branch: develop Module: tests.unit.airpollutionapi30.test_airpollution_client.TestAirPollutionHttpClient

# extract from Travis CI build log

======================================================================
FAIL: test_get_coi (tests.unit.airpollutionapi30.test_airpollution_client.TestAirPollutionHttpClient)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/[secure]/pyowm/tests/unit/airpollutionapi30/test_airpollution_client.py", line 42, in test_get_coi
    self.assertEqual(expected_url, result)
AssertionError: 'co/43.75,8.25/current.json' != {'time': '2016-10-01T13:07:01Z', 'locatio[342 chars]07}]}
======================================================================
FAIL: test_get_o3 (tests.unit.airpollutionapi30.test_airpollution_client.TestAirPollutionHttpClient)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/build/[secure]/pyowm/tests/unit/airpollutionapi30/test_airpollution_client.py", line 93, in test_get_o3
    self.assertEqual(expected_url, result)
AssertionError: 'o3/43.75,8.25/current.json' != {'time': '2016-10-06T13:32:53Z', 'locatio[68 chars]0781}

The same tests pass locally, with all Python versions

It looks like mocking is not working properly on Travis CI and this happens only on that Python test module.