cc-archive / cc-link-checker

Automated link checker for legalcode and license URLs
MIT License
9 stars 13 forks source link

'test_memoize_result' unit test failing #104

Closed avats-dev closed 4 years ago

avats-dev commented 4 years ago

Description

Unit test test_memoize_result failing when unit tests are run on master.

Reproduction

  1. git clone https://github.com/creativecommons/cc-link-checker.git
  2. cd cc-link-checker
  3. pipenv install --dev
  4. pipenv run pytest -v
  5. See error.

Expectation

test_memoize_result should pass along with all other unit tests.

Screenshots

Verbose test Screenshot from 2020-09-01 09-27-06

Failure description Screenshot from 2020-09-01 09-26-24

Environment

Resolution

But I would need guidance.

bhumijgupta commented 4 years ago

Hey! I was able to reproduce this error. The main cause of the error is low request timeout in the test

https://github.com/creativecommons/cc-link-checker/blob/master/link_checker/tests/test_utils.py#L395

The reason that it was passing on CI server is because the server have high bandwidth and they can complete the request in 1 sec while the local computer request fails out in that time. A plausible fix is to change the timeout parameter from 1 to 3.

Hope this helps!

bhumijgupta commented 4 years ago

It should be a quick fix, do let me know if you want to work on the issue.

avats-dev commented 4 years ago

Thanks @bhumijgupta for explaining this, it was bugging me. And yes I would like to work on this. 👍

avats-dev commented 4 years ago

Hey @bhumijgupta , I'm thinking of changing to timeout=2 as this should be enough. I tested for both 2 and 3 and it was same. Previously my connection was too slow so I couldn't get it to pass for 1 but now when I'm checking , it's also passing for 1.