-
Notifications
You must be signed in to change notification settings - Fork 30
Closed
Description
I ran tests for 1.0.11
sdist using pytest
and both test_verify_assert_msg
and test_verify_assert_msg_no_similar_requests
tests fails:
=================================== FAILURES ===================================
____________________________ test_verify_assert_msg ____________________________
httpserver = <HTTPServer host=localhost port=44239>
def test_verify_assert_msg(httpserver: HTTPServer):
httpserver.no_handler_status_code = 404
httpserver.expect_request("/foo", json={"foo": "bar"}, method="POST").respond_with_data("OK")
assert requests.get(httpserver.url_for("/foo"), headers={"User-Agent": "requests"}).status_code == 404
with pytest.raises(AssertionError) as err:
httpserver.assert_request_made(RequestMatcher("/foo", json={"foo": "bar"}, method="POST"))
expected_message = f"""Matching request found 0 times but expected 1 times.
Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={{}} data=None json={{'foo': 'bar'}}>
Found 1 similar request(s):
--- Similar Request Start
Path: /foo
Method: GET
Body: b''
Headers: Host: localhost:{httpserver.port}\r
User-Agent: requests\r
Accept-Encoding: gzip, deflate\r
Accept: */*\r
Connection: keep-alive\r
\r
Query String: ''
--- Similar Request End
""" # noqa: E501
> assert str(err.value) == expected_message
E assert "Matching request found 0 times but expected 1 times.\n Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\n Found 1 similar request(s):\n --- Similar Request Start\n Path: /foo\n Method: GET\n Body: b''\n Headers: Host: localhost:44239\r\n User-Agent: requests\r\n Accept-Encoding: gzip, deflate, br, zstd\r\n Accept: */*\r\n Connection: keep-alive\r\n \r\n \n Query String: ''\n --- Similar Request End\n \nassert 0 == 1" == "Matching request found 0 times but expected 1 times.\nExpected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\nFound 1 similar request(s):\n--- Similar Request Start\nPath: /foo\nMethod: GET\nBody: b''\nHeaders: Host: localhost:44239\r\nUser-Agent: requests\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n\nQuery String: ''\n--- Similar Request End\n"
E
E Matching request found 0 times but expected 1 times.
E - Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
E + Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
E ? ++
E - Found 1 similar request(s):
E + Found 1 similar request(s):
E ? ++
E - --- Similar Request Start
E + --- Similar Request Start
E ? ++
E - Path: /foo
E + Path: /foo
E ? ++
E - Method: GET
E + Method: GET
E ? ++
E - Body: b''
E + Body: b''
E ? ++
E - Headers: Host: localhost:44239
E + Headers: Host: localhost:44239
E ? ++
E - User-Agent: requests
E + User-Agent: requests
E ? ++
E - Accept-Encoding: gzip, deflate
E + Accept-Encoding: gzip, deflate, br, zstd
E ? ++ ++++++++++
E - Accept: */*
E + Accept: */*
E ? ++
E - Connection: keep-alive
E + Connection: keep-alive
E ? ++
E -
E -
E +
E +
E - Query String: ''
E + Query String: ''
E ? ++
E - --- Similar Request End
E + --- Similar Request End
E ? ++
E +
E + assert 0 == 1
tests/test_log_querying.py:60: AssertionError
------------------------------ Captured log call -------------------------------
INFO werkzeug:_internal.py:97 127.0.0.1 - - [20/Jul/2024 15:55:06] "�[33mGET /foo HTTP/1.1�[0m" 404 -
__________________ test_verify_assert_msg_no_similar_requests __________________
httpserver = <HTTPServer host=localhost port=44239>
def test_verify_assert_msg_no_similar_requests(httpserver: HTTPServer):
httpserver.expect_request("/foo", json={"foo": "bar"}, method="POST").respond_with_data("OK")
with pytest.raises(AssertionError) as err:
httpserver.assert_request_made(RequestMatcher("/foo", json={"foo": "bar"}, method="POST"))
expected_message = """Matching request found 0 times but expected 1 times.
Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
No similar requests found.
"""
> assert str(err.value) == expected_message
E assert "Matching request found 0 times but expected 1 times.\n Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\n No similar requests found.\n \nassert 0 == 1" == "Matching request found 0 times but expected 1 times.\nExpected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\nNo similar requests found.\n"
E
E Matching request found 0 times but expected 1 times.
E - Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
E + Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
E ? ++
E - No similar requests found.
E + No similar requests found.
E ? ++
E +
E + assert 0 == 1
tests/test_log_querying.py:73: AssertionError
=========================== short test summary info ============================
FAILED tests/test_log_querying.py::test_verify_assert_msg - assert "Matching request found 0 times but expected 1 times.\n Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\n Found 1 similar request(s):\n --- Similar Request Start\n Path: /foo\n Method: GET\n Body: b''\n Headers: Host: localhost:44239\r\n User-Agent: requests\r\n Accept-Encoding: gzip, deflate, br, zstd\r\n Accept: */*\r\n Connection: keep-alive\r\n \r\n \n Query String: ''\n --- Similar Request End\n \nassert 0 == 1" == "Matching request found 0 times but expected 1 times.\nExpected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\nFound 1 similar request(s):\n--- Similar Request Start\nPath: /foo\nMethod: GET\nBody: b''\nHeaders: Host: localhost:44239\r\nUser-Agent: requests\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\n\r\n\nQuery String: ''\n--- Similar Request End\n"
Matching request found 0 times but expected 1 times.
- Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
+ Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
? ++
- Found 1 similar request(s):
+ Found 1 similar request(s):
? ++
- --- Similar Request Start
+ --- Similar Request Start
? ++
- Path: /foo
+ Path: /foo
? ++
- Method: GET
+ Method: GET
? ++
- Body: b''
+ Body: b''
? ++
- Headers: Host: localhost:44239
+ Headers: Host: localhost:44239
? ++
- User-Agent: requests
+ User-Agent: requests
? ++
- Accept-Encoding: gzip, deflate
+ Accept-Encoding: gzip, deflate, br, zstd
? ++ ++++++++++
- Accept: */*
+ Accept: */*
? ++
- Connection: keep-alive
+ Connection: keep-alive
? ++
-
-
+
+
- Query String: ''
+ Query String: ''
? ++
- --- Similar Request End
+ --- Similar Request End
? ++
+
+ assert 0 == 1
FAILED tests/test_log_querying.py::test_verify_assert_msg_no_similar_requests - assert "Matching request found 0 times but expected 1 times.\n Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\n No similar requests found.\n \nassert 0 == 1" == "Matching request found 0 times but expected 1 times.\nExpected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>\nNo similar requests found.\n"
Matching request found 0 times but expected 1 times.
- Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
+ Expected request: <RequestMatcher uri='/foo' method='POST' query_string=None headers={} data=None json={'foo': 'bar'}>
? ++
- No similar requests found.
+ No similar requests found.
? ++
+
+ assert 0 == 1
============= 2 failed, 99 passed, 8 skipped, 1 xfailed in 12.59s ==============
dbermond
Metadata
Metadata
Assignees
Labels
No labels