Repository navigation
Conversation
pytest reads only the first config file it finds, and pytest.ini takes precedence over setup.cfg. The [tool:pytest] section in setup.cfg was therefore silently ignored (pytest prints "ignoring pytest config in setup.cfg!"), so `make test` never ran the doctests enabled by --doctest-modules and xfail_strict was not enforced. Moving the options into pytest.ini restores the intended configuration: 8 doctests in httpie/ and tests/utils/ are now collected, and all pass.
With xfail_strict now applied from pytest.ini, this test fails on Windows + Python 3.7 in CI with [XPASS(strict)]. Its xfail exists only because the result is unreliable on Windows (see the comment above it), so an occasional pass is expected. Mark it strict=False to keep the previous behaviour for this test while enforcing strict xfail elsewhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pytest only reads the first configuration file it finds, and
pytest.initakes precedence oversetup.cfg. As a result, the[tool:pytest]section insetup.cfgis silently ignored. pytest prints this on every run:This means
--doctest-modules,xfail_strict,testpathsandnorecursedirsare not applied. In particular,make testnever runs the 8 doctests inhttpie/andtests/utils/(e.g.httpie.utils.humanize_bytes, ortests.utils.http, which #1075 previously updated).This PR:
pytest.iniand removes the dead section fromsetup.cfg.TestQuietFlag::test_quiet_on_python_warningsasxfail(strict=False). Its xfail exists because the result is unreliable on Windows (per the comment above it). Withxfail_strictnow active, the first CI run of this PR failed on Windows + Python 3.7 with[XPASS(strict)]; the same jobs on other PRs report1 xpassed.Before / after (
make test, Python 3.12.12, macOS):CI: I compared the first run of this PR job-by-job with the Tests run of another open PR (run 39912759676). Apart from the Windows 3.7 XPASS fixed by the second commit, every job has the same pre-existing failures: Big5 charset detection, argparse quoting on 3.12, pyOpenSSL digest auth (
Context has already been used...), plugin tests on 3.9, and Python 3.7 being unavailable on ubuntu-latest. Each job has more passing tests because of the doctests, which also pass on Windows.