-
Notifications
You must be signed in to change notification settings - Fork 30
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
Comments
Thanks for the report! I spot two issues there. First:
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. The 2nd is more interesting, your test run has a 2-space prefix for each of the messages. For example:
While the acutal error string is constructed like this: pytest-httpserver/pytest_httpserver/httpserver.py Lines 1405 to 1424 in 36807ec
And the expected string in the test constructed like this (this seems to be ok in your test): pytest-httpserver/tests/test_log_querying.py Lines 43 to 60 in 36807ec
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? Zsolt |
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
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. Thanks, |
Actually, I do have both
|
3.9.19
OpenIndiana |
This does not fix the issue for me. Python 3.12.4 in Arch Linux. |
I tried to run test on the
After the test run the BTW, I use this command to run tests:
|
@mtelka @dbermond 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 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 |
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 |
This is where pytest sets the 2-space prefix: |
@csernazs Using branch 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 |
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
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
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
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
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. I'll also to a RCA later on as this was totally unexpected. Thanks for the report! |
All tests pass for me with version 1.0.12 sdist. Thank you! |
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! |
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) <https://github.com/csernazs/pytest-httpserver/issues/345></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>
I ran tests for
1.0.11
sdist usingpytest
and bothtest_verify_assert_msg
andtest_verify_assert_msg_no_similar_requests
tests fails:The text was updated successfully, but these errors were encountered: