1.1.4: pytest is failing because missing `context` and `port` fixtures and some pytest warnings
kloczek opened this issue · comments
pytest is for me and to be honest I know that something is missing in my build env but I cannot figure out which one module(s) I need to install :/
May I as for some hints?
And in below output latest pytest (6.2.4) shows some deprecation warnings
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4
plugins: anyio-3.3.4, cov-3.0.0
collected 11154 items
tests/bugfixes/nosetests/test_242_ssl_bad_handshake.py . [ 0%]
tests/bugfixes/nosetests/test_387_regex_port.py .. [ 0%]
tests/bugfixes/nosetests/test_388_unmocked_error_with_url.py . [ 0%]
tests/bugfixes/nosetests/test_413_regex.py .. [ 0%]
tests/bugfixes/nosetests/test_414_httpx.py . [ 0%]
tests/bugfixes/nosetests/test_416_boto3.py . [ 0%]
tests/bugfixes/nosetests/test_417_openssl.py .. [ 0%]
tests/bugfixes/nosetests/test_425_latest_requests.py . [ 0%]
tests/bugfixes/nosetests/test_430_respect_timeout.py . [ 0%]
tests/bugfixes/nosetests/test_eventlet.py . [ 0%]
tests/bugfixes/nosetests/test_redis.py s [ 0%]
tests/bugfixes/nosetests/test_tornado_bind_unused_port.py s [ 0%]
tests/bugfixes/pytest/test_426_mypy_segfault.py .................................................................................................................... [ 1%]
.................................................................................................................................................................... [ 2%]
.................................................................................................................................................................... [ 4%]
.................................................................................................................................................................... [ 5%]
.................................................................................................................................................................... [ 7%]
.................................................................................................................................................................... [ 8%]
.................................................................................................................................................................... [ 9%]
.................................................................................................................................................................... [ 11%]
.................................................................................................................................................................... [ 12%]
.................................................................................................................................................................... [ 14%]
.................................................................................................................................................................... [ 15%]
.................................................................................................................................................................... [ 17%]
.................................................................................................................................................................... [ 18%]
.................................................................................................................................................................... [ 20%]
.................................................................................................................................................................... [ 21%]
.................................................................................................................................................................... [ 23%]
.................................................................................................................................................................... [ 24%]
.................................................................................................................................................................... [ 26%]
.................................................................................................................................................................... [ 27%]
.................................................................................................................................................................... [ 29%]
.................................................................................................................................................................... [ 30%]
.................................................................................................................................................................... [ 32%]
.................................................................................................................................................................... [ 33%]
.................................................................................................................................................................... [ 34%]
.................................................................................................................................................................... [ 36%]
.................................................................................................................................................................... [ 37%]
.................................................................................................................................................................... [ 39%]
.................................................................................................................................................................... [ 40%]
.................................................................................................................................................................... [ 42%]
.................................................................................................................................................................... [ 43%]
.................................................................................................................................................................... [ 45%]
.................................................................................................................................................................... [ 46%]
.................................................................................................................................................................... [ 48%]
.................................................................................................................................................................... [ 49%]
.................................................................................................................................................................... [ 51%]
.................................................................................................................................................................... [ 52%]
.................................................................................................................................................................... [ 54%]
.................................................................................................................................................................... [ 55%]
.................................................................................................................................................................... [ 57%]
.................................................................................................................................................................... [ 58%]
.................................................................................................................................................................... [ 59%]
.................................................................................................................................................................... [ 61%]
.................................................................................................................................................................... [ 62%]
.................................................................................................................................................................... [ 64%]
.................................................................................................................................................................... [ 65%]
.................................................................................................................................................................... [ 67%]
.................................................................................................................................................................... [ 68%]
.................................................................................................................................................................... [ 70%]
.................................................................................................................................................................... [ 71%]
.................................................................................................................................................................... [ 73%]
.................................................................................................................................................................... [ 74%]
.................................................................................................................................................................... [ 76%]
.................................................................................................................................................................... [ 77%]
.................................................................................................................................................................... [ 79%]
.................................................................................................................................................................... [ 80%]
.................................................................................................................................................................... [ 82%]
.................................................................................................................................................................... [ 83%]
.................................................................................................................................................................... [ 84%]
.................................................................................................................................................................... [ 86%]
.................................................................................................................................................................... [ 87%]
.................................................................................................................................................................... [ 89%]
.................................................................................................................................................................... [ 90%]
.................................................................................................................................................................... [ 92%]
.................................................................................................................................................................... [ 93%]
.................................................................................................................................................................... [ 95%]
.................................................................................................................................................................... [ 96%]
.................................................................................................................................................................... [ 98%]
............................................................ [ 98%]
tests/functional/test_bypass.py EEEE.. [ 98%]
tests/functional/test_debug.py EEEEE [ 98%]
tests/functional/test_decorator.py ...... [ 98%]
tests/functional/test_httplib2.py .......F.... [ 99%]
tests/functional/test_passthrough.py .. [ 99%]
tests/functional/test_requests.py .................E.................. [ 99%]
tests/functional/test_urllib2.py .......F.... [ 99%]
tests/pyopenssl/test_mock.py . [ 99%]
tests/unit/test_core.py .......................... [ 99%]
tests/unit/test_http.py . [ 99%]
tests/unit/test_httpretty.py ............................. [ 99%]
tests/unit/test_main.py ... [100%]
================================================================================== ERRORS ==================================================================================
_________________________________________________________ ERROR at setup of test_httpretty_bypasses_when_disabled __________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py, line 89
@httpretty.activate
@that_with_context(start_http_server, stop_http_server)
def test_httpretty_bypasses_when_disabled(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py:89
_____________________________________________________ ERROR at setup of test_httpretty_bypasses_a_unregistered_request _____________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py, line 123
@httpretty.activate(verbose=True)
@that_with_context(start_http_server, stop_http_server)
def test_httpretty_bypasses_a_unregistered_request(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py:123
_____________________________________________________ ERROR at setup of test_using_httpretty_with_other_tcp_protocols ______________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py, line 146
@httpretty.activate(verbose=True)
@that_with_context(start_tcp_server, stop_tcp_server)
def test_using_httpretty_with_other_tcp_protocols(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py:146
______________________________________________________________ ERROR at setup of test_disallow_net_connect_1 _______________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py, line 164
@httpretty.activate(allow_net_connect=False)
@that_with_context(start_http_server, stop_http_server)
def test_disallow_net_connect_1(context, verbose=True):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_bypass.py:164
___________________________________________________________ ERROR at setup of test_httpretty_debugs_socket_send ____________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py, line 39
@skip('not currently supported')
@httprettified
@scenario(create_socket)
def test_httpretty_debugs_socket_send(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py:39
__________________________________________________________ ERROR at setup of test_httpretty_debugs_socket_sendto ___________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py, line 50
@skip('not currently supported')
@httprettified
@scenario(create_socket)
def test_httpretty_debugs_socket_sendto(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py:50
_________________________________________________________ ERROR at setup of test_httpretty_debugs_socket_recvfrom __________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py, line 61
@skip('not currently supported')
@httprettified
@scenario(create_socket)
def test_httpretty_debugs_socket_recvfrom(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py:61
_________________________________________________________ ERROR at setup of test_httpretty_debugs_socket_recv_into _________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py, line 72
@skip('not currently supported')
@httprettified
@scenario(create_socket)
def test_httpretty_debugs_socket_recv_into(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py:72
_______________________________________________________ ERROR at setup of test_httpretty_debugs_socket_recvfrom_into _______________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py, line 83
@skip('not currently supported')
@httprettified
@scenario(create_socket)
def test_httpretty_debugs_socket_recvfrom_into(context):
E fixture 'context' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_debug.py:83
__________________________________________________________________ ERROR at setup of test_recording_calls __________________________________________________________________
file /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_requests.py, line 770
@use_tornado_server
def test_recording_calls(port):
E fixture 'port' not found
> available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, cov, doctest_namespace, monkeypatch, no_cover, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4/tests/functional/test_requests.py:770
================================================================================= FAILURES =================================================================================
__________________________________________________________________ test_rotating_responses_with_httplib2 ___________________________________________________________________
args = (), kw = {}, start = datetime.datetime(2022, 1, 4, 7, 41, 46, 532196), end = datetime.datetime(2022, 1, 4, 7, 41, 46, 779465)
delta = datetime.timedelta(microseconds=247269), took = 2472.69
def wrap(*args, **kw):
start = datetime.utcnow()
try:
func(start, *args, **kw)
except TypeError as e:
if PY2:
# PY2 has different error message
fmt = "{0}() takes no arguments"
else:
fmt = "{0}() takes 0 positional arguments but 1 was given"
err = text_type(e)
if fmt.format(func.__name__) in err:
func(*args, **kw)
else:
exc.append(traceback.format_exc())
except Exception as e:
exc.append(traceback.format_exc())
end = datetime.utcnow()
delta = end - start
took = convert_to(delta.microseconds)
print(took, timeout)
> assert took < timeout, "%s did not run within %s %s" % (
func.__name__,
word,
unit,
)
E AssertionError: test_rotating_responses_with_httplib2 did not run within two miliseconds
/usr/lib/python3.8/site-packages/sure/__init__.py:217: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
2472.69 2000
___________________________________________________ test_httpretty_should_support_a_list_of_successive_responses_urllib2 ___________________________________________________
args = (), kw = {}, start = datetime.datetime(2022, 1, 4, 7, 41, 49, 387239), end = datetime.datetime(2022, 1, 4, 7, 41, 49, 642311)
delta = datetime.timedelta(microseconds=255072), took = 2550.72
def wrap(*args, **kw):
start = datetime.utcnow()
try:
func(start, *args, **kw)
except TypeError as e:
if PY2:
# PY2 has different error message
fmt = "{0}() takes no arguments"
else:
fmt = "{0}() takes 0 positional arguments but 1 was given"
err = text_type(e)
if fmt.format(func.__name__) in err:
func(*args, **kw)
else:
exc.append(traceback.format_exc())
except Exception as e:
exc.append(traceback.format_exc())
end = datetime.utcnow()
delta = end - start
took = convert_to(delta.microseconds)
print(took, timeout)
> assert took < timeout, "%s did not run within %s %s" % (
func.__name__,
word,
unit,
)
E AssertionError: test_httpretty_should_support_a_list_of_successive_responses_urllib2 did not run within two miliseconds
/usr/lib/python3.8/site-packages/sure/__init__.py:217: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
2550.72 2000
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:6
/usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:6: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
preserves_excinfo = (distutils.version.LooseVersion(greenlet.__version__)
../../../../../usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:7
/usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:7: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
>= distutils.version.LooseVersion('0.3.2'))
tests/bugfixes/nosetests/test_430_respect_timeout.py::test_read_timeout
/usr/lib/python3.8/site-packages/_pytest/threadexception.py:75: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-18
Traceback (most recent call last):
File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-3.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py", line 1133, in fill_filekind
fk.write(utf8(item) + b'\n')
ValueError: write to closed file
warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
tests/functional/test_urllib2.py::test_httpretty_should_allow_forcing_headers_urllib2
/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-3.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py:1034: UserWarning: HTTPretty got to register the Content-Length header with "'35a'" which is not a number
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:355: no redis server available for test
SKIPPED [1] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:355: Skipped
ERROR tests/functional/test_bypass.py::test_httpretty_bypasses_when_disabled
ERROR tests/functional/test_bypass.py::test_httpretty_bypasses_a_unregistered_request
ERROR tests/functional/test_bypass.py::test_using_httpretty_with_other_tcp_protocols
ERROR tests/functional/test_bypass.py::test_disallow_net_connect_1
ERROR tests/functional/test_debug.py::test_httpretty_debugs_socket_send
ERROR tests/functional/test_debug.py::test_httpretty_debugs_socket_sendto
ERROR tests/functional/test_debug.py::test_httpretty_debugs_socket_recvfrom
ERROR tests/functional/test_debug.py::test_httpretty_debugs_socket_recv_into
ERROR tests/functional/test_debug.py::test_httpretty_debugs_socket_recvfrom_into
ERROR tests/functional/test_requests.py::test_recording_calls
FAILED tests/functional/test_httplib2.py::test_rotating_responses_with_httplib2 - AssertionError: test_rotating_responses_with_httplib2 did not run within two miliseconds
FAILED tests/functional/test_urllib2.py::test_httpretty_should_support_a_list_of_successive_responses_urllib2 - AssertionError: test_httpretty_should_support_a_list_of_s...
==================================================== 2 failed, 11140 passed, 2 skipped, 4 warnings, 10 errors in 38.70s ====================================================
These are not fixtures. The test suite is incompatible with pytest, unfortunately.
It woulkd be really good to have pytest support. */9 of my all packages with python modules supprts pytest.
[tkloczko@devel-g2v SPECS]$ grep ^%pytest python-* -l | wc -l; ls -1 python-* -l | wc -l
819
926
Yeah, given how nosetests are completely broken with Python 3.11 (and we really don't want yet another patchset to fix them), I'm going to try to make a patch for this.
Yay, I've found an easy way to fix that. It's not exactly the prettiest method but at least the patch is small.
Tested that commit and indeed it fixes pytest 👍
Howevere there are still few pytest warnings 😋
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-8.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-8.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4
plugins: anyio-3.5.0, cov-3.0.0, mock-3.7.0
collected 11154 items
tests/bugfixes/nosetests/test_242_ssl_bad_handshake.py . [ 0%]
tests/bugfixes/nosetests/test_387_regex_port.py .. [ 0%]
tests/bugfixes/nosetests/test_388_unmocked_error_with_url.py . [ 0%]
tests/bugfixes/nosetests/test_413_regex.py .. [ 0%]
tests/bugfixes/nosetests/test_414_httpx.py . [ 0%]
tests/bugfixes/nosetests/test_416_boto3.py . [ 0%]
tests/bugfixes/nosetests/test_417_openssl.py .. [ 0%]
tests/bugfixes/nosetests/test_425_latest_requests.py . [ 0%]
tests/bugfixes/nosetests/test_430_respect_timeout.py . [ 0%]
tests/bugfixes/nosetests/test_eventlet.py . [ 0%]
tests/bugfixes/nosetests/test_redis.py s [ 0%]
tests/bugfixes/nosetests/test_tornado_bind_unused_port.py s [ 0%]
tests/bugfixes/pytest/test_426_mypy_segfault.py .................................................................................................................... [ 1%]
.................................................................................................................................................................... [ 2%]
.................................................................................................................................................................... [ 4%]
.................................................................................................................................................................... [ 5%]
.................................................................................................................................................................... [ 7%]
.................................................................................................................................................................... [ 8%]
.................................................................................................................................................................... [ 9%]
.................................................................................................................................................................... [ 11%]
.................................................................................................................................................................... [ 12%]
.................................................................................................................................................................... [ 14%]
.................................................................................................................................................................... [ 15%]
.................................................................................................................................................................... [ 17%]
.................................................................................................................................................................... [ 18%]
.................................................................................................................................................................... [ 20%]
.................................................................................................................................................................... [ 21%]
.................................................................................................................................................................... [ 23%]
.................................................................................................................................................................... [ 24%]
.................................................................................................................................................................... [ 26%]
.................................................................................................................................................................... [ 27%]
.................................................................................................................................................................... [ 29%]
.................................................................................................................................................................... [ 30%]
.................................................................................................................................................................... [ 32%]
.................................................................................................................................................................... [ 33%]
.................................................................................................................................................................... [ 34%]
.................................................................................................................................................................... [ 36%]
.................................................................................................................................................................... [ 37%]
.................................................................................................................................................................... [ 39%]
.................................................................................................................................................................... [ 40%]
.................................................................................................................................................................... [ 42%]
.................................................................................................................................................................... [ 43%]
.................................................................................................................................................................... [ 45%]
.................................................................................................................................................................... [ 46%]
.................................................................................................................................................................... [ 48%]
.................................................................................................................................................................... [ 49%]
.................................................................................................................................................................... [ 51%]
.................................................................................................................................................................... [ 52%]
.................................................................................................................................................................... [ 54%]
.................................................................................................................................................................... [ 55%]
.................................................................................................................................................................... [ 57%]
.................................................................................................................................................................... [ 58%]
.................................................................................................................................................................... [ 59%]
.................................................................................................................................................................... [ 61%]
.................................................................................................................................................................... [ 62%]
.................................................................................................................................................................... [ 64%]
.................................................................................................................................................................... [ 65%]
.................................................................................................................................................................... [ 67%]
.................................................................................................................................................................... [ 68%]
.................................................................................................................................................................... [ 70%]
.................................................................................................................................................................... [ 71%]
.................................................................................................................................................................... [ 73%]
.................................................................................................................................................................... [ 74%]
.................................................................................................................................................................... [ 76%]
.................................................................................................................................................................... [ 77%]
.................................................................................................................................................................... [ 79%]
.................................................................................................................................................................... [ 80%]
.................................................................................................................................................................... [ 82%]
.................................................................................................................................................................... [ 83%]
.................................................................................................................................................................... [ 84%]
.................................................................................................................................................................... [ 86%]
.................................................................................................................................................................... [ 87%]
.................................................................................................................................................................... [ 89%]
.................................................................................................................................................................... [ 90%]
.................................................................................................................................................................... [ 92%]
.................................................................................................................................................................... [ 93%]
.................................................................................................................................................................... [ 95%]
.................................................................................................................................................................... [ 96%]
.................................................................................................................................................................... [ 98%]
............................................................ [ 98%]
tests/functional/test_bypass.py ...... [ 98%]
tests/functional/test_debug.py sssss [ 98%]
tests/functional/test_decorator.py ...... [ 98%]
tests/functional/test_httplib2.py ............ [ 99%]
tests/functional/test_passthrough.py ss [ 99%]
tests/functional/test_requests.py .................................... [ 99%]
tests/functional/test_urllib2.py ............ [ 99%]
tests/pyopenssl/test_mock.py . [ 99%]
tests/unit/test_core.py .......................... [ 99%]
tests/unit/test_http.py . [ 99%]
tests/unit/test_httpretty.py ............................. [ 99%]
tests/unit/test_main.py ... [100%]
============================================================================= warnings summary =============================================================================
../../../../../usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:6
/usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:6: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
preserves_excinfo = (distutils.version.LooseVersion(greenlet.__version__)
../../../../../usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:7
/usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:7: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
>= distutils.version.LooseVersion('0.3.2'))
tests/bugfixes/nosetests/test_430_respect_timeout.py::test_read_timeout
/usr/lib/python3.8/site-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-18
Traceback (most recent call last):
File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-8.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py", line 1133, in fill_filekind
fk.write(utf8(item) + b'\n')
ValueError: write to closed file
warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
tests/functional/test_urllib2.py::test_httpretty_should_allow_forcing_headers_urllib2
/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-8.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py:1034: UserWarning: HTTPretty got to register the Content-Length header with "'35a'" which is not a number
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================
SKIPPED [1] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:364: no redis server available for test
SKIPPED [3] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:364: Skipped
SKIPPED [5] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:364: not currently supported
============================================================== 11145 passed, 9 skipped, 4 warnings in 59.56s ===============================================================
Just retested in updated build env and now I have one unit failing
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.16, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/HTTPretty-1.1.4
plugins: anyio-3.6.2, cov-4.0.0, mock-3.10.0
collected 11154 items
tests/bugfixes/nosetests/test_242_ssl_bad_handshake.py . [ 0%]
tests/bugfixes/nosetests/test_387_regex_port.py .. [ 0%]
tests/bugfixes/nosetests/test_388_unmocked_error_with_url.py . [ 0%]
tests/bugfixes/nosetests/test_413_regex.py .. [ 0%]
tests/bugfixes/nosetests/test_414_httpx.py . [ 0%]
tests/bugfixes/nosetests/test_416_boto3.py . [ 0%]
tests/bugfixes/nosetests/test_417_openssl.py .. [ 0%]
tests/bugfixes/nosetests/test_425_latest_requests.py . [ 0%]
tests/bugfixes/nosetests/test_430_respect_timeout.py . [ 0%]
tests/bugfixes/nosetests/test_eventlet.py . [ 0%]
tests/bugfixes/nosetests/test_redis.py s [ 0%]
tests/bugfixes/nosetests/test_tornado_bind_unused_port.py s [ 0%]
tests/bugfixes/pytest/test_426_mypy_segfault.py ..................................................................................................................................... [ 1%]
..................................................................................................................................................................................... [ 2%]
..................................................................................................................................................................................... [ 4%]
..................................................................................................................................................................................... [ 6%]
..................................................................................................................................................................................... [ 7%]
..................................................................................................................................................................................... [ 9%]
..................................................................................................................................................................................... [ 11%]
..................................................................................................................................................................................... [ 12%]
..................................................................................................................................................................................... [ 14%]
..................................................................................................................................................................................... [ 15%]
..................................................................................................................................................................................... [ 17%]
..................................................................................................................................................................................... [ 19%]
..................................................................................................................................................................................... [ 20%]
..................................................................................................................................................................................... [ 22%]
..................................................................................................................................................................................... [ 24%]
..................................................................................................................................................................................... [ 25%]
..................................................................................................................................................................................... [ 27%]
..................................................................................................................................................................................... [ 28%]
..................................................................................................................................................................................... [ 30%]
..................................................................................................................................................................................... [ 32%]
..................................................................................................................................................................................... [ 33%]
..................................................................................................................................................................................... [ 35%]
..................................................................................................................................................................................... [ 37%]
..................................................................................................................................................................................... [ 38%]
..................................................................................................................................................................................... [ 40%]
..................................................................................................................................................................................... [ 41%]
..................................................................................................................................................................................... [ 43%]
..................................................................................................................................................................................... [ 45%]
..................................................................................................................................................................................... [ 46%]
..................................................................................................................................................................................... [ 48%]
..................................................................................................................................................................................... [ 50%]
..................................................................................................................................................................................... [ 51%]
..................................................................................................................................................................................... [ 53%]
..................................................................................................................................................................................... [ 54%]
..................................................................................................................................................................................... [ 56%]
..................................................................................................................................................................................... [ 58%]
..................................................................................................................................................................................... [ 59%]
..................................................................................................................................................................................... [ 61%]
..................................................................................................................................................................................... [ 62%]
..................................................................................................................................................................................... [ 64%]
..................................................................................................................................................................................... [ 66%]
..................................................................................................................................................................................... [ 67%]
..................................................................................................................................................................................... [ 69%]
..................................................................................................................................................................................... [ 71%]
..................................................................................................................................................................................... [ 72%]
..................................................................................................................................................................................... [ 74%]
..................................................................................................................................................................................... [ 75%]
..................................................................................................................................................................................... [ 77%]
..................................................................................................................................................................................... [ 79%]
..................................................................................................................................................................................... [ 80%]
..................................................................................................................................................................................... [ 82%]
..................................................................................................................................................................................... [ 84%]
..................................................................................................................................................................................... [ 85%]
..................................................................................................................................................................................... [ 87%]
..................................................................................................................................................................................... [ 88%]
..................................................................................................................................................................................... [ 90%]
..................................................................................................................................................................................... [ 92%]
..................................................................................................................................................................................... [ 93%]
..................................................................................................................................................................................... [ 95%]
..................................................................................................................................................................................... [ 97%]
..................................................................................................................................................................................... [ 98%]
....... [ 98%]
tests/functional/test_bypass.py ...... [ 98%]
tests/functional/test_debug.py sssss [ 98%]
tests/functional/test_decorator.py ...... [ 98%]
tests/functional/test_httplib2.py ............ [ 99%]
tests/functional/test_passthrough.py ss [ 99%]
tests/functional/test_requests.py ...................................F [ 99%]
tests/functional/test_urllib2.py ............ [ 99%]
tests/pyopenssl/test_mock.py . [ 99%]
tests/unit/test_core.py .......................... [ 99%]
tests/unit/test_http.py . [ 99%]
tests/unit/test_httpretty.py ............................. [ 99%]
tests/unit/test_main.py ... [100%]
========================================================================================= FAILURES ==========================================================================================
_______________________________________________________________ test_httpretty_should_handle_paths_starting_with_two_slashes ________________________________________________________________
self = <sure.AssertionBuilder object at 0x7f5f24f11d60>, args = ('//foo',), kw = {}
@wraps(func)
def wrapper(self, *args, **kw):
try:
> value = func(self, *args, **kw)
/usr/lib/python3.8/site-packages/sure/__init__.py:408:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sure.AssertionBuilder object at 0x7f5f24f11d60>, what = '//foo', epsilon = None
@assertionmethod
def equal(self, what, epsilon=None):
"""compares given object ``X`` with an expected ``Y`` object.
It primarily assures that the compared objects are absolute equal ``==``.
:param what: the expected value
:param epsilon: a delta to leverage upper-bound floating point permissiveness
"""
try:
comparison = DeepComparison(self.obj, what, epsilon).compare()
error = False
except AssertionError as e:
error = e
comparison = None
if isinstance(comparison, DeepExplanation):
error = comparison.get_assertion(self.obj, what)
if self.negative:
if error:
return True
msg = "%s should differ from %s, but is the same thing"
raise AssertionError(msg % (safe_repr(self.obj), safe_repr(what)))
else:
if not error:
return True
> raise error
/usr/lib/python3.8/site-packages/sure/__init__.py:729:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sure.AssertionBuilder object at 0x7f5f24f11d60>, what = '//foo', epsilon = None
@assertionmethod
def equal(self, what, epsilon=None):
"""compares given object ``X`` with an expected ``Y`` object.
It primarily assures that the compared objects are absolute equal ``==``.
:param what: the expected value
:param epsilon: a delta to leverage upper-bound floating point permissiveness
"""
try:
> comparison = DeepComparison(self.obj, what, epsilon).compare()
/usr/lib/python3.8/site-packages/sure/__init__.py:710:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sure.core.DeepComparison object at 0x7f5f2404a1f0>
def compare(self):
X, Y = self.operands
if isinstance(X, _CallList):
X = list(X)
if isinstance(Y, _CallList):
X = list(Y)
c = self.get_context()
if self.is_complex(X) and type(X) is type(Y):
return self.compare_complex_stuff(X, Y)
def safe_format_repr(string):
"Escape '{' and '}' in string for use with str.format()"
if not isinstance(string, (string_types, binary_type)):
return string
orig_str_type = type(string)
if isinstance(string, binary_type):
safe_repr = string.replace(b'{', b'{{').replace(b'}', b'}}')
else:
safe_repr = string.replace('{', '{{').replace('}', '}}')
# NOTE: str.replace() automatically converted the 'string' to 'unicode' in Python 2
return orig_str_type(safe_repr)
# get safe representation for X and Y
safe_X, safe_Y = safe_format_repr(X), safe_format_repr(Y)
# maintaining backwards compatibility between error messages
kwargs = {}
if self.is_simple(X) and self.is_simple(Y):
kwargs['msg_format'] = 'X{{0}} is {0!r} whereas Y{{1}} is {1!r}'.format(safe_X, safe_Y)
elif type(X) is not type(Y):
kwargs['msg_format'] = 'X{{0}} is a {0} and Y{{1}} is a {1} instead'.format(
type(X).__name__, type(Y).__name__)
exp = self.compare_generic(X, Y, **kwargs)
if isinstance(exp, DeepExplanation):
original_X, original_Y = c.parent.operands
> raise exp.as_assertion(original_X, original_Y)
/usr/lib/python3.8/site-packages/sure/core.py:254:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = "X is '/foo' whereas Y is '//foo'", X = '/foo', Y = '//foo'
def as_assertion(self, X, Y):
> raise self.get_assertion(X, Y)
E AssertionError: given
E X = '/foo'
E and
E Y = '//foo'
E X is '/foo' whereas Y is '//foo'
/usr/lib/python3.8/site-packages/sure/core.py:57: AssertionError
During handling of the above exception, another exception occurred:
@httprettified
def test_httpretty_should_handle_paths_starting_with_two_slashes():
"HTTPretty should handle URLs with paths starting with //"
HTTPretty.register_uri(
HTTPretty.GET, "http://example.com//foo",
body="Find the best foo"
)
response = requests.get('http://example.com//foo')
expect(response.text).to.equal('Find the best foo')
expect(HTTPretty.last_request.method).to.equal('GET')
> expect(HTTPretty.last_request.path).to.equal('//foo')
tests/functional/test_requests.py:949:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <sure.AssertionBuilder object at 0x7f5f24f11d60>, args = ('//foo',), kw = {}
@wraps(func)
def wrapper(self, *args, **kw):
try:
value = func(self, *args, **kw)
except AssertionError as e:
> raise AssertionError(e)
E AssertionError: given
E X = '/foo'
E and
E Y = '//foo'
E X is '/foo' whereas Y is '//foo'
/usr/lib/python3.8/site-packages/sure/__init__.py:410: AssertionError
===================================================================================== warnings summary ======================================================================================
../../BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py:176
/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py:176: DeprecationWarning: 'urllib3.contrib.pyopenssl' module is deprecated and will be removed in a future release of urllib3 2.x. Read more in this issue: https://github.com/urllib3/urllib3/issues/2680
from requests.packages.urllib3.contrib.pyopenssl import inject_into_urllib3, extract_from_urllib3
../../BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py:185
/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py:185: DeprecationWarning: 'urllib3.contrib.pyopenssl' module is deprecated and will be removed in a future release of urllib3 2.x. Read more in this issue: https://github.com/urllib3/urllib3/issues/2680
from urllib3.contrib.pyopenssl import extract_from_urllib3, inject_into_urllib3
../../../../../usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:6
/usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:6: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
preserves_excinfo = (distutils.version.LooseVersion(greenlet.__version__)
../../../../../usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:7
/usr/lib/python3.8/site-packages/eventlet/support/greenlets.py:7: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
>= distutils.version.LooseVersion('0.3.2'))
tests/bugfixes/nosetests/test_430_respect_timeout.py::test_read_timeout
/usr/lib/python3.8/site-packages/_pytest/threadexception.py:73: PytestUnhandledThreadExceptionWarning: Exception in thread Thread-18
Traceback (most recent call last):
File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib64/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py", line 1133, in fill_filekind
fk.write(utf8(item) + b'\n')
ValueError: write to closed file
warnings.warn(pytest.PytestUnhandledThreadExceptionWarning(msg))
tests/functional/test_requests.py::test_recording_calls
/usr/lib64/python3.8/site-packages/tornado/ioloop.py:350: DeprecationWarning: make_current is deprecated; start the event loop first
self.make_current()
tests/functional/test_urllib2.py::test_httpretty_should_allow_forcing_headers_urllib2
/home/tkloczko/rpmbuild/BUILDROOT/python-httpretty-1.1.4-13.fc35.x86_64/usr/lib/python3.8/site-packages/httpretty/core.py:1034: UserWarning: HTTPretty got to register the Content-Length header with "'35a'" which is not a number
warnings.warn(
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
SKIPPED [1] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:367: no redis server available for test
SKIPPED [3] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:367: Skipped
SKIPPED [5] ../../../../../usr/lib/python3.8/site-packages/_pytest/unittest.py:367: not currently supported
FAILED tests/functional/test_requests.py::test_httpretty_should_handle_paths_starting_with_two_slashes - AssertionError: given
================================================================== 1 failed, 11144 passed, 9 skipped, 7 warnings in 23.97s ==================================================================
Here is list of installed modules in build env
Package Version
----------------------------- -----------------
alabaster 0.7.12
anyio 3.6.2
async-timeout 4.0.2
attrs 22.2.0
Babel 2.11.0
boto3 1.26.49
botocore 1.29.49
build 0.9.0
certifi 2022.9.24
cffi 1.15.1
charset-normalizer 3.0.1
coverage 7.0.3
cryptography 38.0.4
distro 1.8.0
dnspython 2.2.1
docutils 0.19
eventlet 0.33.1
exceptiongroup 1.0.0
extras 1.0.0
fixtures 4.0.0
freezegun 1.2.1
gpg 1.18.0-unknown
greenlet 1.1.3
h11 0.13.0
httpcore 0.16.3
httplib2 0.20.4
httpx 0.23.3
idna 3.4
imagesize 1.4.1
importlib-metadata 5.1.0
iniconfig 1.1.1
Jinja2 3.1.2
jmespath 1.0.0
libcomps 0.1.19
MarkupSafe 2.1.1
mock 4.0.3
packaging 21.3
pbr 5.9.0
pep517 0.13.0
pip 22.3.1
pluggy 1.0.0
ply 3.11
pycparser 2.21
Pygments 2.14.0
PyGObject 3.42.2
pyOpenSSL 22.0.0
pyparsing 3.0.9
pytest 7.2.0
pytest-cov 4.0.0
pytest-mock 3.10.0
python-dateutil 2.8.2
pytz 2022.4
redis 4.4.0
requests 2.28.1
rpm 4.17.0
s3transfer 0.6.0
setuptools 65.6.3
six 1.16.0
sniffio 1.2.0
snowballstemmer 2.2.0
Sphinx 5.3.0
sphinx-rtd-theme 1.1.1
sphinxcontrib-applehelp 1.0.2.dev20221204
sphinxcontrib.asciinema 0.3.3
sphinxcontrib-devhelp 1.0.2.dev20221204
sphinxcontrib-htmlhelp 2.0.0
sphinxcontrib-jsmath 1.0.1.dev20221204
sphinxcontrib-qthelp 1.0.3.dev20221204
sphinxcontrib-serializinghtml 1.1.5
sure 2.0.0
testtools 2.5.0
tomli 2.0.1
tornado 6.2
urllib3 1.26.12
wheel 0.38.4
zipp 3.11.0