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

1.0.11: test_verify_assert_msg and test_verify_assert_msg_no_similar_requests fails #345

Closed
mtelka opened this issue Jul 20, 2024 · 15 comments · Fixed by #346
Closed

1.0.11: test_verify_assert_msg and test_verify_assert_msg_no_similar_requests fails #345

mtelka opened this issue Jul 20, 2024 · 15 comments · Fixed by #346

Comments

@mtelka
Copy link

mtelka commented Jul 20, 2024

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 ==============
@csernazs
Copy link
Owner

Thanks for the report!

I spot two issues there.

First:

  - Accept-Encoding: gzip, deflate
  +   Accept-Encoding: gzip, deflate, br, zstd

It is likely you had ztsd or zstandard packages installed and requests (urllib3 to be more exact) picked up these, and then specified these Accept-Encoding headers. I can try workaround this in the tests, so it won't be dynamic.
I could re-produce this by installing urllib3[zstd].

The 2nd is more interesting, your test run has a 2-space prefix for each of the messages.

For example:

  - 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):

While the acutal error string is constructed like this:

if similar_requests:
assert_msg_lines.append(f"Found {len(similar_requests)} similar request(s):")
for request in similar_requests:
assert_msg_lines.extend(
(
"--- Similar Request Start",
f"Path: {request.path}",
f"Method: {request.method}",
f"Body: {request.get_data()!r}",
f"Headers: {request.headers}",
f"Query String: {request.query_string.decode('utf-8')!r}",
"--- Similar Request End",
)
)
else:
assert_msg_lines.append("No similar requests found.")
assert_msg = "\n".join(assert_msg_lines) + "\n"
assert matching_count == count, assert_msg

And the expected string in the test constructed like this (this seems to be ok in your test):

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

Based on the repr() shown by pylint this is 2 spaces and atm I have no ide where those prefixes came from.

Which python version are you using?
Which system?

Zsolt

csernazs added a commit that referenced this issue Jul 20, 2024
Accept-Encoding is constructed dynamically by the availability of the
compression libraries (eg.  zstd, zstandard) so it can result failed test at
the end.

Fixes #345
@csernazs
Copy link
Owner

Could you please try running the test on the branch where I pushed the fix?

I still have no clue about the 2-spaces prefix.
Could you please check if the test file is intact? Eg. you could try to run the tests on the cloned repo.
I compared the files in git vs the sdist and these are identical.

Thanks,
Zsolt

@mtelka
Copy link
Author

mtelka commented Jul 20, 2024

First:

  - Accept-Encoding: gzip, deflate
  +   Accept-Encoding: gzip, deflate, br, zstd

It is likely you had ztsd or zstandard packages installed and requests (urllib3 to be more exact) picked up these, and then specified these Accept-Encoding headers. I can try workaround this in the tests, so it won't be dynamic. I could re-produce this by installing urllib3[zstd].

Actually, I do have both ztsd and zstandard. I tried to re-run tests (from the sdist) with both ztsd and zstandard uninstalled and I see this:

E         - Accept-Encoding: gzip, deflate
E         +   Accept-Encoding: gzip, deflate, br
E         ? ++                              ++++

@mtelka
Copy link
Author

mtelka commented Jul 20, 2024

Which python version are you using?

3.9.19

Which system?

OpenIndiana

@dbermond
Copy link

Could you please try running the test on the branch where I pushed the fix?

This does not fix the issue for me. Python 3.12.4 in Arch Linux.

@mtelka
Copy link
Author

mtelka commented Jul 20, 2024

Could you please try running the test on the branch where I pushed the fix?

I tried to run test on the fix-345 branch and I no longer see difference in the Accept-Encoding: (even with both ztsd and zstandard installed). The br difference is gone as well. I only see the 2-space issue.

I still have no clue about the 2-spaces prefix. Could you please check if the test file is intact? Eg. you could try to run the tests on the cloned repo. I compared the files in git vs the sdist and these are identical.

After the test run the git status command shows no difference.

BTW, I use this command to run tests: env - PYTHONPATH=. PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 PYTEST_PLUGINS="pytest_httpserver" pytest -vv --color=no and I do have many python modules installed:

$ pip freeze
aiohttp==3.9.3
aiosignal==1.3.1
alabaster==0.7.16
aniso8601==9.0.1
annotated-types==0.7.0
ansi2html==1.9.2
ansible==8.7.0
ansible-core==2.15.12
anyio==4.2.0
apeye==1.4.1
apeye-core==1.1.5
appdirs==1.4.4
argcomplete==3.4.0
argh==0.31.3
argon2-cffi==23.1.0
argon2-cffi-bindings==21.2.0
asgiref==3.8.1
asn1crypto==1.5.1
assertpy==1.1
astor==0.8.1
astroid==3.2.3
asttokens==2.4.1
async-generator==1.10
async-timeout==4.0.3
atomicwrites==1.4.1
attrs==23.2.0
autocommand==2.2.2
Automat==22.10.0
autopage==0.5.2
autopep8==2.3.1
Babel==2.15.0
backcall==0.2.0
backports.entry-points-selectable==1.3.0
backports.tarfile==1.2.0
barman==3.10.1
bcrypt==4.1.3
beautifulsoup4==4.12.3
betamax==0.9.0
black==24.4.2
bleach==6.1.0
blessings==1.7
blinker==1.8.2
borgbackup==1.4.0
bottle==0.12.25
bracex==2.4
Brotli==1.1.0
brotlicffi==1.1.0.0
BTrees==6.0
build==1.2.1
CacheControl==0.14.0
cached-property==1.5.2
cachetools==5.4.0
calver==2022.6.26
cattrs==23.2.3
ccsm==0.8.18
certifi==2024.7.4
cffi==1.16.0
cfgv==3.4.0
Chameleon==4.5.4
characteristic==14.3.0
chardet==5.2.0
charset-normalizer==3.3.2
check-manifest==0.49
cheroot==10.0.1
CherryPy==18.10.0
chevron==0.14.0
CJKwrap==2.2
cleo==2.1.0
click==8.1.7
click-help-colors==0.9.4
cliff==4.7.0
cloudpickle==3.0.0
cmarkgfm==2024.1.14
cmd2==2.4.3
codecov==2.1.13
codespell==2.3.0
coincidence==0.6.6
colorama==0.4.6
colorlog==6.8.2
configobj==5.0.8
ConfigUpdater==3.2
consolekit==1.7.0
constantly==23.10.4
contextlib2==21.6.0
contextvars==2.4
covdefaults==2.3.0
coverage==7.6.0
coverage-enable-subprocess==1.0
coveralls==4.0.1
crashtest==0.4.1
crmsh==4.5.0
cryptography==42.0.8
cryptography_vectors==42.0.8
cssselect==1.2.0
cupshelpers==1.0
curio==1.6
Cython==3.0.10
cython-test-exception-raiser==1.0.2
dbus-python==1.3.2
ddt==1.7.2
decorator==5.1.1
defusedxml==0.7.1
deprecation==2.1.0
deprecation-alias==0.3.3
detect-test-pollution==1.2.0
diff_cover==9.1.0
dill==0.3.8
dirty-equals==0.7.1.post0
dist-meta==0.8.1
distlib==0.3.8
distro==1.9.0
dnspython==2.6.1
docopt==0.6.2
docutils==0.21.2
dogpile.cache==1.3.3
dom_toml==2.0.0
domdf_python_tools==3.9.0
dulwich==0.22.1
dunamai==1.21.2
editables==0.5
elastic-transport==8.13.1
elasticsearch==8.14.0
elementpath==4.4.0
email_validator==2.2.0
ephemeral-port-reserve==1.1.4
eval_type_backport==0.2.0
exceptiongroup==1.2.2
execnet==2.1.1
executing==2.0.1
expandvars==0.12.0
extras==1.0.0
factory-boy==3.3.0
fail2ban==1.0.2
Faker==26.0.0
fastjsonschema==2.19.1
fields==5.0.0
filelock==3.15.4
findpython==0.6.1
fixtures==4.1.0
flake8==7.1.0
flake8-2020==1.8.1
flake8-bugbear==24.4.26
flake8-docstrings==1.7.0
flake8-noqa==1.4.0
flake8-typing-imports==1.15.0
flaky==3.8.1
flamegraph==0.1
Flask==3.0.3
flex==6.14.1
flit_core==3.9.0
flit_scm==1.7.0
flufl.flake8==0.10
freezegun==1.5.1
frozendict==2.4.4
frozenlist==1.4.1
fs==2.4.16
func-timeout==4.3.5
future==1.0.0
gevent==24.2.1
ghp-import==2.1.0
gi-docgen==2024.1
gitdb==4.0.11
GitPython==3.1.43
gprof2dot==2024.6.6
graphviz==0.20.3
greenlet==3.0.3
gunicorn==22.0.0
h11==0.14.0
h2==4.1.0
handy-archives==0.2.0
hatch-fancy-pypi-readme==24.1.0
hatch-nodejs-version==0.3.2
hatch-requirements-txt==0.4.1
hatch-vcs==0.4.0
hatchling==1.25.0
housekeeping==1.1
hpack==4.0.0
http-parser==0.9.0
httpcore==1.0.5
httplib2==0.22.0
httpx==0.27.0
humanize==4.9.0
hupper==1.12.1
hyperframe==6.0.1
hyperlink==21.0.0
hypothesis==6.108.2
icecream==2.1.3
identify==2.6.0
idna==3.7
imagesize==1.4.1
immutables==0.20
importcheck==0.5.0
importlib_metadata==8.0.0
importlib_resources==6.4.0
incremental==22.10.0
inflect==7.3.1
ini2toml==0.15
iniconfig==2.0.0
installer==0.7.0
invocations==3.3.0
invoke==2.2.0
iocapture==0.1.2
ipdb==0.13.13
ipython==8.18.1
iso8601==2.1.0
isort==5.13.2
itsdangerous==2.2.0
jaraco.classes==3.4.0
jaraco.collections==5.0.1
jaraco.context==5.3.0
jaraco.develop==8.15.0
jaraco.env==1.0.0
jaraco.envs==2.6.0
jaraco.functools==4.0.1
jaraco.itertools==6.4.1
jaraco.packaging==10.2.2
jaraco.path==3.7.0
jaraco.test==5.4.0
jaraco.text==3.14.0
jaraco.ui==2.3.0
jaraco.vcs==2.2.0
jaraco.versioning==1.1.0
jedi==0.19.1
Jinja2==3.1.4
jmespath==1.0.1
jsonpointer==3.0.0
jsonrpclib-pelix==0.4.3.3
jsonschema==4.23.0
jsonschema-specifications==2023.12.1
jupyter_core==5.7.2
keyring==25.2.1
keyrings.alt==5.0.1
kgb==7.1.1
lazy==1.6
lazy-object-proxy==1.10.0
libcst==1.4.0
lingua==4.15.0
linkify-it-py==2.0.3
littleutils==0.2.2
looseversion==1.3.0
louis==3.30.0
lxml==5.2.2
lxml-stubs==0.5.1
lxml_html_clean==0.1.1
maison==1.4.3
Mako==1.3.5
manuel==1.12.4
Markdown==3.6
markdown-it-py==3.0.0
markdown2==2.5.0
MarkupSafe==2.1.5
marshmallow==3.21.3
matplotlib-inline==0.1.7
maturin==1.7.0
mccabe==0.7.0
mdurl==0.1.2
mercurial==5.9.3
mergedeep==1.3.4
meson==1.4.1
mistletoe==1.4.0
mistune==3.0.2
mkdocs==1.6.0
mkdocs-bootstrap==1.1.1
mkdocs-bootswatch==1.1
mkdocs-get-deps==0.2.0
mock==5.1.0
more-itertools==10.3.0
msgpack==1.0.8
multidict==6.0.5
mutagen==1.47.0
mypy==1.11.0
mypy-extensions==1.0.0
mysqlclient==2.2.4
natsort==8.4.0
nbformat==5.10.4
netsnmp-python==1.0a1
nh3==0.2.18
nose==1.3.7
notify2==0.3.1
nox==2024.4.15
numpy==1.26.4
objgraph==3.6.1
olefile==0.47
outcome==1.3.0.post0
packaging==24.1
parameterized==0.8.1
paramiko==3.4.0
parso==0.8.4
passlib==1.7.4
Paste==3.10.1
PasteDeploy==3.1.0
path==16.14.0
path.py==12.5.0
pathlib2==2.3.7.post1
pathspec==0.12.1
pbr==6.0.0
pdm-backend==2.3.3
pep440==0.1.2
persistent==6.0
pexpect==4.9.0
pickleshare==0.7.5
pillow==10.4.0
pip-run==13.0.0
pipdeptree==2.23.1
pipenv==2024.0.1
pkg==0.1
pkgconfig==1.5.5
pkginfo==1.11.1
pkgutil_resolve_name==1.3.10
plaster==1.1.2
plaster-pastedeploy==1.0.1
platformdirs==4.2.2
pluggy==1.5.0
ply==3.11
poetry-core==1.9.0
poetry-dynamic-versioning==1.4.0
polib==1.2.0
portend==3.2.0
powerline-status==2.8.3
pretend==1.0.9
prettytable==3.10.2
process-tests==3.0.0
prompt_toolkit==3.0.47
psutil==6.0.0
psycopg2==2.9.9
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
py-cpuinfo==9.0.0
py3c==1.4
pyasn1==0.6.0
pyasn1_modules==0.4.0
pybind11==2.13.1
pybonjour==1.1.1
pycairo==1.26.1
pycmd==1.2
pycodestyle==2.12.0
PyContracts==2.0.1
pycparser==2.22
pycryptodome==3.20.0
pycryptodome-test-vectors==1.0.16
pycryptodomex==3.20.0
pycups==2.0.4
pycurl==7.45.3
pydantic==2.8.2
pydantic_core==2.20.1
pydiff==0.2
pydiffx==1.1
pydocstyle==6.3.0
pyfakefs==5.6.0
pyflakes==3.2.0
pyftpdlib==1.5.10
Pygments==2.18.0
PyGObject==3.46.0
PyHamcrest==2.1.0
PyJWT==2.8.0
pylint==3.2.5
pymongo==4.8.0
PyNaCl==1.5.0
PyNUTClient==2.8.2
pyOpenSSL==24.1.0
pyparsing==3.1.2
pyperclip==1.9.0
pyproject-api==1.7.1
pyproject-examples==2023.6.30
pyproject-fmt==2.1.4
pyproject-fmt-rust==1.1.5
pyproject-installer==0.5.4
pyproject-metadata==0.8.0
pyproject-parser==0.11.1
pyproject_hooks==1.0.0
PyQt-builder==1.16.4
PyQt5==5.15.11
PyQt5_sip==12.15.0
pyramid==2.0.1
pyroma==4.2
pyrsistent==0.20.0
PySocks==1.7.1
pytest==8.2.2
pytest-asyncio==0.23.6
pytest-benchmark==4.0.0
pytest-black==0.3.12
pytest-check==2.3.1
pytest-checkdocs==2.13.0
pytest-console-scripts==1.4.1
pytest-cov==5.0.0
pytest-custom-exit-code==0.3.0
pytest-datadir==1.5.0
pytest-enabler==3.1.1
pytest-env==1.1.3
pytest-expect==1.1.0
pytest-fixture-config==1.7.0
pytest-flake8==1.1.1
pytest-forked==1.6.0
pytest-helpers-namespace==2021.12.29
pytest-home==0.5.1
pytest-ignore-flaky==2.2.1
pytest-lazy-fixtures==1.1.0
pytest-metadata==3.1.1
pytest-mock==3.14.0
pytest-mypy==0.10.3
pytest-mypy-plugins==3.1.2
pytest-perf==0.15.0
pytest-randomly==3.15.0
pytest-regressions==2.5.0
pytest-relaxed==2.0.2
pytest-reporter==0.5.3
pytest-rerunfailures==14.0
pytest-salt-factories==1.0.1
pytest-shell-utilities==1.9.0
pytest-skip-markers==1.5.1
pytest-socket==0.7.0
pytest-subprocess==1.5.0
pytest-subtests==0.13.1
pytest-system-statistics==1.0.2
pytest-timeout==2.3.1
pytest-travis-fold==1.3.0
pytest-xdist==3.6.1
pytest-xprocess==0.23.0
pytest_freezer==0.4.8
pytest_httpserver==1.0.11
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-magic==0.4.27
python-rapidjson==1.18
python-subunit==1.4.4
python-xlib==0.33
pytidylib==0.3.2
pytoml==0.1.21
pytoolconfig==1.3.1
pytz==2024.1
pyxdg==0.28
PyYAML==6.0.1
pyyaml_env_tag==0.1
pyzmq==26.0.3
qualname==0.1.0
railroad-diagrams==3.0.1
rapidfuzz==3.9.3
RBTools==5.0
rdiff-backup==2.2.6
re-assert==1.1.0
readme_renderer==44.0
readthedocs-sphinx-ext==2.2.5
redis==5.0.7
referencing==0.35.1
regex==2024.5.15
releases==2.1.1
repoze.lru==0.7
repoze.sphinx.autointerface==1.0.0
requests==2.32.3
requests-file==2.1.0
requests-toolbelt==1.0.0
requests-wsgi-adapter==0.4.1
resolvelib==1.0.1
rfc3986==2.0.0
rfc3987==1.3.8
rich==13.7.1
Routes==2.5.1
rpds-py==0.19.0
rrdtool==0.1.10
ruamel.yaml==0.18.6
ruamel.yaml.clib==0.2.8
ruyaml==0.91.0
salt==3007.1
schema==0.7.7
scikit-build==0.18.0
scikit_build_core==0.9.8
SCons==4.8.0
scour==0.38.2
scripttest==1.3
sdjson==0.5.0
seedir==0.5.0
semantic-version==2.10.0
serpent==1.41
service-identity==24.1.0
setuptools-declarative-requirements==1.3.0
setuptools-rust==1.9.0
setuptools-scm==8.1.0
sh==1.14.3
shellingham==1.5.4
shippinglabel==2.0.0
simplegeneric==0.8.1
simplejson==3.19.2
singledispatch==4.1.0
sip==6.8.6
six==1.16.0
smartypants==2.0.1
smmap==5.0.1
sniffio==1.3.1
snowballstemmer==2.2.0
socksio==1.0.0
sortedcontainers==2.4.0
soupsieve==2.5
spec==1.4.1
Sphinx==7.4.6
sphinx-autodoc-typehints==2.2.3
sphinx-issues==4.1.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
sphobjinv==2.3.1.1
sqlparse==0.5.1
stack-data==0.6.3
stdio-mgr==1.0.1
stestr==4.1.0
stevedore==5.2.0
strict-rfc3339==0.7
strictyaml==1.7.3
subprocess-tee==0.4.2
sure==2.0.1
sybil==6.1.1
tabulate==0.9.0
teamcity-messages==1.32
tempora==5.6.0
termcolor==2.4.0
terminator==2.1.1
termstyle==0.1.11
testfixtures==8.3.0
testpath==0.6.0
testresources==2.0.1
testscenarios==0.5.0
testtools==2.7.2
texttable==1.7.0
time-machine==2.14.2
tokenize-rt==5.2.0
toml==0.10.2
tomli==2.0.1
tomli_w==1.0.0
tomlkit==0.13.0
tornado==6.4.1
tox==4.16.0
tox-current-env==0.0.11
tqdm==4.66.4
traitlets==5.14.3
transaction==4.0
translationstring==1.4
trove-classifiers==2024.7.2
trustme==1.1.0
twine==5.1.1
Twisted==24.3.0
typeguard==4.3.0
types-decorator==5.1.8.20240310
types-docutils==0.21.0.20240711
types-mock==5.1.0.20240425
types-paramiko==3.4.0.20240423
types-psutil==6.0.0.20240621
types-python-dateutil==2.9.0.20240316
types-pytz==2024.1.0.20240417
types-PyYAML==6.0.12.20240311
types-requests==2.32.0.20240712
types-setuptools==70.3.0.20240710
types-six==1.16.21.20240513
types-toml==0.10.8.20240310
typing-inspect==0.9.0
typing_extensions==4.12.2
typogrify==2.0.7
tzdata==2024.1
u-msgpack-python==2.8.0
uc-micro-py==1.0.3
ukkonen==1.0.1
UkPostcodeParser==1.1.2
unearth==0.16.1
Unidecode==1.3.8
urllib3==2.1.0
uvicorn==0.30.1
validate-email==1.3
validate-pyproject==0.16
validators==0.33.0
venusian==3.1.0
versioneer==0.29
virtualenv==20.26.3
voluptuous==0.15.2
waitress==3.0.0
watchdog==4.0.1
wcag-contrast-ratio==0.9
wcmatch==8.5.2
wcwidth==0.2.13
webencodings==0.5.1
WebOb==1.8.7
websockets==12.0
WebTest==3.0.0
Werkzeug==3.0.3
whey==0.1.1
wrapt==1.16.0
WSGIProxy2==0.5.1
xmlschema==3.3.1
xmltodict==0.13.0
yamlfix==1.16.0
yamllint==1.35.1
yarl==1.9.4
youtube-dl==2021.12.17
yt-dlp==2024.7.16
zc.lockfile==3.0.post1
ZConfig==4.1
zest.releaser==9.2.0
zipp==3.19.2
ZODB==6.0
zodbpickle==4.0
zope.component==6.0
zope.configuration==5.0.1
zope.copy==4.3
zope.deferredimport==5.0
zope.deprecation==5.0
zope.event==5.0
zope.exceptions==5.1
zope.hookable==6.0
zope.i18nmessageid==6.1.0
zope.interface==6.4.post2
zope.location==5.0
zope.proxy==5.2
zope.schema==7.0.1
zope.security==7.0
zope.testing==5.0.1
zope.testrunner==6.4
zstandard==0.23.0
zstd==1.5.5.1
$

@csernazs
Copy link
Owner

@mtelka
Just FYI: br was likely added by the brotli package. Each additional encoding has its corresponding compression python package.

@dbermond
Could you please share more details why the tests failed for you still on this branch?
Is this because of the 2-space prefix issue or the headers or both?
CI runs tests on python 3.12, so on my side it went well.

To both of you:

The project provides a poetry.lock, so all the CI and the developers run the tests in a venv where only those packages are installed. You can create the venv by running make dev and then start the tests by make tests. Could you try doing it?

I could reproduce the 2-space issue by installing a lots of pytest plugins so we need to bisect which pytest plugin causes this, just to have an RCA.

Zsolt

@csernazs
Copy link
Owner

hi all (@dbermond , @mtelka ),

I pushed a fix to the fix-345 branch, could you please re-run the test on it?

This should fix both errors you reported.

Zsolt

@csernazs
Copy link
Owner

Quick update:

I could reproduce this by installing pytest-httpserver from wheel to a virtualenv, then running the tests on the contents of the sdist tarball. This is exactly what you described, but I could't believe this is different from running tests from the sources cloned from github (where the test passes), sorry for that.

So it seems not the additional packages cause the issue but the installation method somehow causes this..

But my fix should solve it so I'm waiting for a feedback from you before I merge the fix.

Zsolt

@csernazs
Copy link
Owner

@dbermond
Copy link

I pushed a fix to the fix-345 branch, could you please re-run the test on it?

This should fix both errors you reported.

@csernazs Using branch fix-345 with the new commits added today fixes both issues for me.

Thank you for fixing this.

Do you intend to release a new version with the fixes or will it stay only in git master for the time being?

@csernazs
Copy link
Owner

I pushed a fix to the fix-345 branch, could you please re-run the test on it?

This should fix both errors you reported.

@csernazs Using branch fix-345 with the new commits added today fixes both issues for me.

Thank you for fixing this.

Do you intend to release a new version with the fixes or will it stay only in git master for the time being?

Thanks!

Yes, I want to release a view version with the fix as it is included in sdist, and the tests don't work with the released wheel.

I'll update the ticket when it is ready.

Zsolt

csernazs added a commit that referenced this issue Jul 21, 2024
In some cases assert messages are prefixed by 2 spaces and we don't have to
be strict here. The key is to compare the contents pytest-httpserver
provides, so we split the message by lines and also strip them.

Fixes #345
csernazs added a commit that referenced this issue Jul 21, 2024
In some cases assert messages are prefixed by 2 spaces and we don't have to
be strict here. The key is to compare the contents pytest-httpserver
provides, so we split the message by lines and also strip them.

Fixes #345
csernazs added a commit that referenced this issue Jul 21, 2024
Accept-Encoding is constructed dynamically by the availability of the
compression libraries (eg.  zstd, zstandard) so it can result failed test at
the end.

Fixes #345
csernazs added a commit that referenced this issue Jul 21, 2024
In some cases assert messages are prefixed by 2 spaces and we don't have to
be strict here. The key is to compare the contents pytest-httpserver
provides, so we split the message by lines and also strip them.

Fixes #345
@csernazs
Copy link
Owner

@mtelka @dbermond

Version 1.0.12 just has been released with the fix to pypi. I checked it on my host and I could ran the sdist tests with the pytest-httpserver installed from wheel to the venv.
So I hope it will be fixed for you as well. If not, feel free to re-open this issue.

I'll also to a RCA later on as this was totally unexpected.

Thanks for the report!
Zsolt

@mtelka
Copy link
Author

mtelka commented Jul 21, 2024

All tests pass for me with version 1.0.12 sdist. Thank you!

@dbermond
Copy link

I also can confirm that tests are passing fine in version 1.0.12 in Arch Linux.

Thank for the assistance and for fixing this!

zifeo pushed a commit to zifeo/dataconf that referenced this issue Aug 1, 2024
Bumps [pytest-httpserver](https://github.com/csernazs/pytest-httpserver)
from 1.0.10 to 1.0.12.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/csernazs/pytest-httpserver/releases">pytest-httpserver's
releases</a>.</em></p>
<blockquote>
<h2>1.0.12</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix pytest-httpserver's own tests related to log querying. No
functional changes in pytest-httpserver code itself. <a
href="https://github.com/csernazs/pytest-httpserver/issues/345">csernazs/pytest-httpserver#345</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/csernazs/pytest-httpserver/compare/1.0.11...1.0.12">https://github.com/csernazs/pytest-httpserver/compare/1.0.11...1.0.12</a></p>
<h2>1.0.11</h2>
<h2>What's Changed</h2>
<ul>
<li>Hooks API</li>
<li>New methods added to query for matching requests in the log.</li>
<li>Threading support to serve requests in parallel</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/csernazs/pytest-httpserver/compare/1.0.10...1.0.11">https://github.com/csernazs/pytest-httpserver/compare/1.0.10...1.0.11</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/csernazs/pytest-httpserver/blob/master/CHANGES.rst">pytest-httpserver's
changelog</a>.</em></p>
<blockquote>
<h1>1.0.12</h1>
<p>.. _Release Notes_1.0.12_Bug Fixes:</p>
<h2>Bug Fixes</h2>
<ul>
<li>Fix pytest-httpserver's own tests related to log querying. No
functional
changes in pytest-httpserver code itself.
<code>[#345](csernazs/pytest-httpserver#345)
&lt;https://github.com/csernazs/pytest-httpserver/issues/345&gt;</code>_</li>
</ul>
<p>.. _Release Notes_1.0.11:</p>
<h1>1.0.11</h1>
<p>.. _Release Notes_1.0.11_New Features:</p>
<h2>New Features</h2>
<ul>
<li>
<p>Hooks API</p>
</li>
<li>
<p>New methods added to query for matching requests in the log.</p>
</li>
<li>
<p>Threading support to serve requests in parallel</p>
</li>
</ul>
<p>.. _Release Notes_1.0.10:</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/170c7962a70955ca9f0f7eca7e43809577e0010b"><code>170c796</code></a>
CHANGES.rst: add release notes for 1.0.12</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/887fc1bc9615ecc56c028bce315eff3e04e99a96"><code>887fc1b</code></a>
Version bump to 1.0.12</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/12cf6895efa14f2e821d069de5fe6afd17e9bc2d"><code>12cf689</code></a>
tests: fix assert message comparison</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/6b660e7ed7b37c117b3a964ce9958e8c9d399071"><code>6b660e7</code></a>
tests: fix test_verify_assert_msg by setting Accept-Encoding</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/36807ec83645edc7dc6effba8fb1951cf194c2d0"><code>36807ec</code></a>
CHANGES.rst: add release notes for 1.0.11</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/054f44a20ca6319ec1b86e7d7eec39336a2a8267"><code>054f44a</code></a>
Version bump to 1.0.11</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/f75322e08417549a1ec05fd1536a6897c921486e"><code>f75322e</code></a>
[pre-commit.ci] pre-commit autoupdate</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/79417600b786506f794363bb01354e73414b3a48"><code>7941760</code></a>
pyproject.tom: update test group deps</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/3df1304b973c3837fcb0c360230689557f107397"><code>3df1304</code></a>
CI: bump poetry version</li>
<li><a
href="https://github.com/csernazs/pytest-httpserver/commit/37db07b25129306caf0337ac1cabfaa7609b9331"><code>37db07b</code></a>
CI: refactor cache keys to use the actual python version</li>
<li>Additional commits viewable in <a
href="https://github.com/csernazs/pytest-httpserver/compare/1.0.10...1.0.12">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pytest-httpserver&package-manager=pip&previous-version=1.0.10&new-version=1.0.12)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants