Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
args: [--safe, --quiet]
Expand Down
24 changes: 8 additions & 16 deletions tests/test_reportlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def test_basics(testdir, tmp_path, pytestconfig):
We don't test the test reports extensively because they have been
tested already in ``test_reports``.
"""
p = testdir.makepyfile(
"""
p = testdir.makepyfile("""
import warnings

def test_ok():
Expand All @@ -51,8 +50,7 @@ def test_fail():

def test_warning():
warnings.warn("message", UserWarning)
"""
)
""")

log_file = tmp_path / "log.json"

Expand Down Expand Up @@ -114,8 +112,7 @@ def test_warning():
def test_exclude_logs_for_passing_tests(testdir, tmp_path, exclude):
passing_log_entry = "THIS TEST PASSED!"
failing_log_entry = "THIS TEST FAILED!"
testdir.makepyfile(
f"""
testdir.makepyfile(f"""
import logging

logger = logging.getLogger(__name__)
Expand All @@ -126,8 +123,7 @@ def test_ok():
def test_fail():
logger.warning("{failing_log_entry}")
assert 0
"""
)
""")
fn = tmp_path / "result.log"
if exclude:
result = testdir.runpytest(
Expand All @@ -147,8 +143,7 @@ def test_fail():

def test_xdist_integration(testdir, tmp_path):
pytest.importorskip("xdist")
testdir.makepyfile(
"""
testdir.makepyfile("""
import warnings

def test_ok():
Expand All @@ -159,8 +154,7 @@ def test_fail():

def test_warning():
warnings.warn("message", UserWarning)
"""
)
""")
fn = tmp_path / "result.log"
result = testdir.runpytest("-n2", f"--report-log={fn}")
result.stdout.fnmatch_lines("*1 failed, 2 passed, 1 warning*")
Expand Down Expand Up @@ -190,13 +184,11 @@ def __str__(self):

def test_subtest(pytester, tmp_path):
"""Regression test for #90."""
pytester.makepyfile(
"""
pytester.makepyfile("""
def test_foo(subtests):
with subtests.test():
pass
"""
)
""")
fn = tmp_path / "result.log"
result = pytester.runpytest(f"--report-log={fn}")
result.stdout.fnmatch_lines("*1 passed in*")
Expand Down