-
Notifications
You must be signed in to change notification settings - Fork 108
Add pytest-reportlog integration test and document compatibility #379
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,3 @@ | ||||||
| Add an integration test covering ``pytest-reportlog`` compatibility: each | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. — Comment created by Claude
Suggested change
|
||||||
| attempt is emitted as a ``TestReport``, with retried failures using the | ||||||
| ``"rerun"`` outcome. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -617,6 +617,29 @@ def test_pass(): | |
| assert_outcomes(result, passed=1, rerun=2) | ||
|
|
||
|
|
||
| def test_reportlog_contains_rerun_reports(testdir): | ||
| pytest.importorskip("pytest_reportlog") | ||
| testdir.makepyfile( | ||
| f""" | ||
| def test_pass(): | ||
| {temporary_failure()}""" | ||
| ) | ||
| result = testdir.runpytest("--reruns", "1", "--report-log=log.jsonl") | ||
| assert_outcomes(result, passed=1, rerun=1) | ||
|
|
||
| import json | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. — Comment created by Claude Minor: |
||
|
|
||
| reports = [ | ||
| json.loads(line) | ||
| for line in testdir.tmpdir.join("log.jsonl").read().splitlines() | ||
| if line.strip() | ||
| ] | ||
| test_reports = [r for r in reports if r.get("$report_type") == "TestReport"] | ||
| call_reports = [r for r in test_reports if r.get("when") == "call"] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. — Comment created by Claude The test only checks
A regression in those paths would not be caught. Either check all |
||
| assert [r["outcome"] for r in call_reports] == ["rerun", "passed"] | ||
| assert [r["rerun"] for r in call_reports] == [0, 1] | ||
|
|
||
|
|
||
| def test_flaky_marker_with_zero_reruns_disables_rerun(testdir): | ||
| testdir.makepyfile( | ||
| f""" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ minversion = 4.0 | |
| commands = pytest tests/ {posargs} | ||
| deps = | ||
| xdist: pytest-xdist | ||
| pytest-reportlog | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. — Comment created by Claude This only affects local
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes pytest-reportlog a dependency for all tests, which I do not like. — 100 % human review, no AI involved: Weight higher than the AI generated comments. |
||
| pytest82: pytest==8.2.* | ||
| pytest83: pytest==8.3.* | ||
| pytest84: pytest==8.4.* | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
— Comment created by Claude
The user-facing part of this PR is this new compatibility note. The only change log fragment is
134.misc.rst, and it describes the test setup. If the note should show up under Documentation in the change log, consider adding a134.doc.rstfragment, e.g.Document compatibility with pytest-reportlog.