I am building httpretty for the mainframe architecture s390x based on openSUSE Tumbleweed.
There are some failing tests:
[ 272s] =================================== FAILURES ===================================
[ 272s] ______________________________ test_read_timeout _______________________________
[ 272s]
[ 272s] self = <sure.AssertionBuilder object at 0x3ff9a9b1550>, args = (0.2,), kw = {}
[ 272s]
[ 272s] @wraps(func)
[ 272s] def wrapper(self, *args, **kw):
[ 272s] try:
[ 272s] > value = func(self, *args, **kw)
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:408:
[ 272s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 272s]
[ 272s] self = <sure.AssertionBuilder object at 0x3ff9a9b1550>, dest = 0.2
[ 272s]
[ 272s] @assertionmethod
[ 272s] def lower_than(self, dest):
[ 272s] if self.negative:
[ 272s] msg = "expected `{0}` to not be lower than `{1}`".format(self.obj, dest)
[ 272s]
[ 272s] assert not self.obj < dest, msg
[ 272s]
[ 272s] else:
[ 272s] msg = "expected `{0}` to be lower than `{1}`".format(self.obj, dest)
[ 272s] > assert self.obj < dest, msg
[ 272s] E AssertionError: expected `0.2305901050567627` to be lower than `0.2`
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:835: AssertionError
[ 272s]
[ 272s] During handling of the above exception, another exception occurred:
[ 272s]
[ 272s] @httprettified(verbose=True, allow_net_connect=False)
[ 272s] def test_read_timeout():
[ 272s] "#430 httpretty should respect read timeout"
[ 272s] event = Event()
[ 272s] uri = "http://example.com"
[ 272s]
[ 272s] # Given that I register a uri with a callback body that delays 10 seconds
[ 272s] wait_seconds = 10
[ 272s]
[ 272s] def my_callback(request, url, headers):
[ 272s] event.wait(wait_seconds)
[ 272s] return 200, headers, "Received"
[ 272s]
[ 272s] HTTPretty.register_uri(HTTPretty.GET, uri, body=my_callback)
[ 272s]
[ 272s] # And I use a thread pool with 1 TCP connection max
[ 272s] max_connections = 1
[ 272s] request = http(max_connections)
[ 272s] started_at = time.time()
[ 272s] # When I make an HTTP request with a read timeout of 0.1 and an indefinite connect timeout
[ 272s] when_called = request.get.when.called_with(uri, timeout=(None, 0.1))
[ 272s]
[ 272s] # Then the request should have raised a connection timeout
[ 272s] when_called.should.have.raised(ReadTimeout)
[ 272s]
[ 272s] # And the total execution time should be less than 0.2 seconds
[ 272s] event.set()
[ 272s] total_time = time.time() - started_at
[ 272s] > total_time.should.be.lower_than(0.2)
[ 272s]
[ 272s] tests/bugfixes/nosetests/test_430_respect_timeout.py:54:
[ 272s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 272s]
[ 272s] self = <sure.AssertionBuilder object at 0x3ff9a9b1550>, args = (0.2,), kw = {}
[ 272s]
[ 272s] @wraps(func)
[ 272s] def wrapper(self, *args, **kw):
[ 272s] try:
[ 272s] value = func(self, *args, **kw)
[ 272s] except AssertionError as e:
[ 272s] > raise AssertionError(e)
[ 272s] E AssertionError: expected `0.2305901050567627` to be lower than `0.2`
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:410: AssertionError
[ 272s] ____________________ test_rotating_responses_with_httplib2 _____________________
[ 272s]
[ 272s] args = (), kw = {}, start = datetime.datetime(2022, 10, 25, 13, 3, 13, 960550)
[ 272s] end = datetime.datetime(2022, 10, 25, 13, 3, 14, 342034)
[ 272s] delta = datetime.timedelta(microseconds=381484), took = 3814.84
[ 272s]
[ 272s] def wrap(*args, **kw):
[ 272s] start = datetime.utcnow()
[ 272s]
[ 272s] try:
[ 272s] func(start, *args, **kw)
[ 272s] except TypeError as e:
[ 272s] if PY2:
[ 272s] # PY2 has different error message
[ 272s] fmt = "{0}() takes no arguments"
[ 272s] else:
[ 272s] fmt = "{0}() takes 0 positional arguments but 1 was given"
[ 272s] err = text_type(e)
[ 272s] if fmt.format(func.__name__) in err:
[ 272s] func(*args, **kw)
[ 272s] else:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] except Exception as e:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] end = datetime.utcnow()
[ 272s] delta = end - start
[ 272s] took = convert_to(delta.microseconds)
[ 272s] print(took, timeout)
[ 272s] > assert took < timeout, "%s did not run within %s %s" % (
[ 272s] func.__name__,
[ 272s] word,
[ 272s] unit,
[ 272s] )
[ 272s] E AssertionError: test_rotating_responses_with_httplib2 did not run within two miliseconds
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:217: AssertionError
[ 272s] ----------------------------- Captured stdout call -----------------------------
[ 272s] 3814.84 2000
[ 272s] ____________________________ test_callback_response ____________________________
[ 272s]
[ 272s] args = (), kw = {}, start = datetime.datetime(2022, 10, 25, 13, 3, 14, 370477)
[ 272s] end = datetime.datetime(2022, 10, 25, 13, 3, 14, 611931)
[ 272s] delta = datetime.timedelta(microseconds=241454), took = 2414.54
[ 272s]
[ 272s] def wrap(*args, **kw):
[ 272s] start = datetime.utcnow()
[ 272s]
[ 272s] try:
[ 272s] func(start, *args, **kw)
[ 272s] except TypeError as e:
[ 272s] if PY2:
[ 272s] # PY2 has different error message
[ 272s] fmt = "{0}() takes no arguments"
[ 272s] else:
[ 272s] fmt = "{0}() takes 0 positional arguments but 1 was given"
[ 272s] err = text_type(e)
[ 272s] if fmt.format(func.__name__) in err:
[ 272s] func(*args, **kw)
[ 272s] else:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] except Exception as e:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] end = datetime.utcnow()
[ 272s] delta = end - start
[ 272s] took = convert_to(delta.microseconds)
[ 272s] print(took, timeout)
[ 272s] > assert took < timeout, "%s did not run within %s %s" % (
[ 272s] func.__name__,
[ 272s] word,
[ 272s] unit,
[ 272s] )
[ 272s] E AssertionError: test_callback_response did not run within two miliseconds
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:217: AssertionError
[ 272s] ----------------------------- Captured stdout call -----------------------------
[ 272s] 2414.54 2000
[ 272s] ____________________ test_rotating_responses_with_requests _____________________
[ 272s]
[ 272s] args = (), kw = {}, start = datetime.datetime(2022, 10, 25, 13, 3, 15, 247484)
[ 272s] end = datetime.datetime(2022, 10, 25, 13, 3, 15, 508520)
[ 272s] delta = datetime.timedelta(microseconds=261036), took = 2610.36
[ 272s]
[ 272s] def wrap(*args, **kw):
[ 272s] start = datetime.utcnow()
[ 272s]
[ 272s] try:
[ 272s] func(start, *args, **kw)
[ 272s] except TypeError as e:
[ 272s] if PY2:
[ 272s] # PY2 has different error message
[ 272s] fmt = "{0}() takes no arguments"
[ 272s] else:
[ 272s] fmt = "{0}() takes 0 positional arguments but 1 was given"
[ 272s] err = text_type(e)
[ 272s] if fmt.format(func.__name__) in err:
[ 272s] func(*args, **kw)
[ 272s] else:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] except Exception as e:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] end = datetime.utcnow()
[ 272s] delta = end - start
[ 272s] took = convert_to(delta.microseconds)
[ 272s] print(took, timeout)
[ 272s] > assert took < timeout, "%s did not run within %s %s" % (
[ 272s] func.__name__,
[ 272s] word,
[ 272s] unit,
[ 272s] )
[ 272s] E AssertionError: test_rotating_responses_with_requests did not run within two miliseconds
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:217: AssertionError
[ 272s] ----------------------------- Captured stdout call -----------------------------
[ 272s] 2610.36 2000
[ 272s] ________________________ test_can_inspect_last_request _________________________
[ 272s]
[ 272s] args = (), kw = {}, start = datetime.datetime(2022, 10, 25, 13, 3, 15, 999488)
[ 272s] end = datetime.datetime(2022, 10, 25, 13, 3, 16, 298155)
[ 272s] delta = datetime.timedelta(microseconds=298667), took = 2986.67
[ 272s]
[ 272s] def wrap(*args, **kw):
[ 272s] start = datetime.utcnow()
[ 272s]
[ 272s] try:
[ 272s] func(start, *args, **kw)
[ 272s] except TypeError as e:
[ 272s] if PY2:
[ 272s] # PY2 has different error message
[ 272s] fmt = "{0}() takes no arguments"
[ 272s] else:
[ 272s] fmt = "{0}() takes 0 positional arguments but 1 was given"
[ 272s] err = text_type(e)
[ 272s] if fmt.format(func.__name__) in err:
[ 272s] func(*args, **kw)
[ 272s] else:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] except Exception as e:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] end = datetime.utcnow()
[ 272s] delta = end - start
[ 272s] took = convert_to(delta.microseconds)
[ 272s] print(took, timeout)
[ 272s] > assert took < timeout, "%s did not run within %s %s" % (
[ 272s] func.__name__,
[ 272s] word,
[ 272s] unit,
[ 272s] )
[ 272s] E AssertionError: test_can_inspect_last_request did not run within two miliseconds
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:217: AssertionError
[ 272s] ----------------------------- Captured stdout call -----------------------------
[ 272s] 2986.67 2000
[ 272s] _____ test_httpretty_should_support_a_list_of_successive_responses_urllib2 _____
[ 272s]
[ 272s] args = (), kw = {}, start = datetime.datetime(2022, 10, 25, 13, 3, 17, 834381)
[ 272s] end = datetime.datetime(2022, 10, 25, 13, 3, 18, 666219)
[ 272s] delta = datetime.timedelta(microseconds=831838), took = 8318.38
[ 272s]
[ 272s] def wrap(*args, **kw):
[ 272s] start = datetime.utcnow()
[ 272s]
[ 272s] try:
[ 272s] func(start, *args, **kw)
[ 272s] except TypeError as e:
[ 272s] if PY2:
[ 272s] # PY2 has different error message
[ 272s] fmt = "{0}() takes no arguments"
[ 272s] else:
[ 272s] fmt = "{0}() takes 0 positional arguments but 1 was given"
[ 272s] err = text_type(e)
[ 272s] if fmt.format(func.__name__) in err:
[ 272s] func(*args, **kw)
[ 272s] else:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] except Exception as e:
[ 272s] exc.append(traceback.format_exc())
[ 272s]
[ 272s] end = datetime.utcnow()
[ 272s] delta = end - start
[ 272s] took = convert_to(delta.microseconds)
[ 272s] print(took, timeout)
[ 272s] > assert took < timeout, "%s did not run within %s %s" % (
[ 272s] func.__name__,
[ 272s] word,
[ 272s] unit,
[ 272s] )
[ 272s] E AssertionError: test_httpretty_should_support_a_list_of_successive_responses_urllib2 did not run within two miliseconds
[ 272s]
[ 272s] /usr/lib/python3.8/site-packages/sure/__init__.py:217: AssertionError
It seems, that max. 0,2 is made for one test, but the test is receiving 0.2305901050567627. That will be used also for the timeout, which is the reason for the error messages:
AssertionError: expected 0.2305901050567627 to be lower than 0.2
AssertionError: test_rotating_responses_with_httplib2 did not run within two miliseconds
AssertionError: test_callback_response did not run within two miliseconds
I am building httpretty for the mainframe architecture s390x based on openSUSE Tumbleweed. There are some failing tests:
It seems, that max. 0,2 is made for one test, but the test is receiving 0.2305901050567627. That will be used also for the timeout, which is the reason for the error messages:
0.2305901050567627
to be lower than0.2