generated from tophat/new-project-kit
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: improve reporting around xfailed snapshots, close #736
- Loading branch information
Noah Negin-Ulster
committed
Jul 11, 2023
1 parent
6a93c87
commit c4faee7
Showing
5 changed files
with
96 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
def test_no_failure_printed_if_all_failures_xfailed(testdir): | ||
testdir.makepyfile( | ||
test_file=( | ||
""" | ||
import pytest | ||
@pytest.mark.xfail(reason="Failure expected.") | ||
def test_a(snapshot): | ||
assert snapshot == 'does-not-exist' | ||
""" | ||
) | ||
) | ||
result = testdir.runpytest("-v") | ||
result.stdout.no_re_match_line((r".*snapshot failed*")) | ||
assert result.ret == 0 | ||
|
||
|
||
def test_failures_printed_if_only_some_failures_xfailed(testdir): | ||
testdir.makepyfile( | ||
test_file=( | ||
""" | ||
import pytest | ||
@pytest.mark.xfail(reason="Failure expected.") | ||
def test_a(snapshot): | ||
assert snapshot == 'does-not-exist' | ||
def test_b(snapshot): | ||
assert snapshot == 'other' | ||
""" | ||
) | ||
) | ||
result = testdir.runpytest("-v") | ||
result.stdout.re_match_lines((r".*1 snapshot failed*")) | ||
result.stdout.re_match_lines((r".*1 snapshot xfailed*")) | ||
assert result.ret == 1 | ||
|
||
|
||
def test_failure_printed_if_xfail_does_not_run(testdir): | ||
testdir.makepyfile( | ||
test_file=( | ||
""" | ||
import pytest | ||
@pytest.mark.xfail(False, reason="Failure expected.") | ||
def test_a(snapshot): | ||
assert snapshot == 'does-not-exist' | ||
""" | ||
) | ||
) | ||
result = testdir.runpytest("-v") | ||
result.stdout.re_match_lines((r".*1 snapshot failed*")) | ||
result.stdout.no_re_match_line((r".*1 snapshot xfailed*")) | ||
assert result.ret == 1 |
This file contains 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
c4faee7
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.
Benchmark
benchmarks/test_1000x.py::test_1000x_reads
0.8396683522814027
iter/sec (stddev: 0.04039367444905228
)0.7214816129612851
iter/sec (stddev: 0.06489018132786964
)0.86
benchmarks/test_1000x.py::test_1000x_writes
0.8329530382118241
iter/sec (stddev: 0.06323483918281417
)0.7320864379628735
iter/sec (stddev: 0.0858032333813154
)0.88
benchmarks/test_standard.py::test_standard
0.8077681056750313
iter/sec (stddev: 0.05143075505108469
)0.694756948242633
iter/sec (stddev: 0.11733256694474728
)0.86
This comment was automatically generated by workflow using github-action-benchmark.