Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_httpretty_should_allow_adding_and_overwritting_by_kwargs_u2 fails when clock not in sync with GitHub #376

Closed
nphilou opened this issue Mar 12, 2019 · 1 comment · Fixed by #394

Comments

@nphilou
Copy link

nphilou commented Mar 12, 2019

======================================================================
FAIL: tests.functional.test_requests.test_httpretty_should_allow_adding_and_overwritting_by_kwargs_u2
HTTPretty should allow adding and overwritting headers by keyword args with requests
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/lj5ly4j5p79s1dzzsgp83jw6l2k96mm6-python3.6-nose-1.3.7/lib/python3.6/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/nix/store/lj5ly4j5p79s1dzzsgp83jw6l2k96mm6-python3.6-nose-1.3.7/lib/python3.6/site-packages/nose/util.py", line 620, in newfunc
    return func(*arg, **kw)
  File "/build/httpretty-0.9.6/httpretty/core.py", line 1702, in wrapper
    return test(*args, **kw)
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/__init__.py", line 209, in wrap
    raise AssertionError(exc.pop(0))
AssertionError: Traceback (most recent call last):
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/__init__.py", line 385, in wrapper
    value = func(self, *args, **kw)
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/__init__.py", line 673, in equal
    raise error
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/__init__.py", line 654, in equal
    comparison = DeepComparison(self.obj, what, epsilon).compare()
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/core.py", line 224, in compare
    return self.compare_complex_stuff(X, Y)
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/core.py", line 84, in compare_complex_stuff
    return self.complex_cmp_funcs.get(type(X), self.compare_generic)(X, Y)
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/core.py", line 141, in compare_dicts
    parent=self,
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/core.py", line 254, in compare
    raise exp.as_assertion(original_X, original_Y)
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/core.py", line 57, in as_assertion
    raise self.get_assertion(X, Y)
AssertionError: given
X = {'connection': 'close', 'content-length': '27', 'content-type': 'application/json', 'date': 'Tue, 12 Mar 2019 16:06:22 GMT', 'server': 'Apache', 'status': '200'}
    and
Y = {'connection': 'close', 'content-length': '27', 'content-type': 'application/json', 'date': 'Tue, 12 Mar 2019 16:06:21 GMT', 'server': 'Apache', 'status': '200'}
X['date'] is 'Tue, 12 Mar 2019 16:06:22 GMT' whereas Y['date'] is 'Tue, 12 Mar 2019 16:06:21 GMT'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/__init__.py", line 186, in wrap
    func(start, *args, **kw)
  File "/build/httpretty-0.9.6/tests/functional/test_requests.py", line 182, in test_httpretty_should_allow_adding_and_overwritting_by_kwargs_u2
    'date': now.strftime('%a, %d %b %Y %H:%M:%S GMT'),
  File "/nix/store/sgsc1kqhby7z1f2vs71ff9x63mw4wa9i-python3.6-sure-1.4.11/lib/python3.6/site-packages/sure/__init__.py", line 387, in wrapper
    raise AssertionError(e)
AssertionError: given
X = {'connection': 'close', 'content-length': '27', 'content-type': 'application/json', 'date': 'Tue, 12 Mar 2019 16:06:22 GMT', 'server': 'Apache', 'status': '200'}
    and
Y = {'connection': 'close', 'content-length': '27', 'content-type': 'application/json', 'date': 'Tue, 12 Mar 2019 16:06:21 GMT', 'server': 'Apache', 'status': '200'}
X['date'] is 'Tue, 12 Mar 2019 16:06:22 GMT' whereas Y['date'] is 'Tue, 12 Mar 2019 16:06:21 GMT'

'date': now.strftime('%a, %d %b %Y %H:%M:%S GMT'),

This makes this test fail randomly due to network lag or unsynced clocks.

@vanschelven
Copy link

Can confirm that this happened for me too; also can confirm that it's random (didn't happen on retry)

jonringer pushed a commit to NixOS/nixpkgs that referenced this issue Feb 23, 2020
vanschelven added a commit to vanschelven/nixpkgs that referenced this issue Feb 25, 2020
vanschelven added a commit to vanschelven/nixpkgs that referenced this issue Feb 25, 2020
mgorny added a commit to mgorny/HTTPretty that referenced this issue Mar 10, 2020
Use mocked clock when running tests involving checking the 'Date'
header.  These tests used system clock so far which caused frequent
test failures if the check occurred in the second following generating
the response.

Fixes gabrielfalcao#376
mgorny added a commit to mgorny/HTTPretty that referenced this issue Mar 11, 2020
Use mocked clock when running tests involving checking the 'Date'
header.  These tests used system clock so far which caused frequent
test failures if the check occurred in the second following generating
the response.

Fixes gabrielfalcao#376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants