Skip to content

Commit

Permalink
Test multiline non-verbose timer
Browse files Browse the repository at this point in the history
  • Loading branch information
afcmrp committed Jan 11, 2025
1 parent bfde3f0 commit 9f666a4
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions testing/test_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,21 @@ def test_foobar(i): pass
""",
)

@pytest.fixture
def more_tests_files(self, pytester: Pytester) -> None:
pytester.makepyfile(
test_bar="""
import pytest
@pytest.mark.parametrize('i', range(30))
def test_bar(i): pass
""",
test_foo="""
import pytest
@pytest.mark.parametrize('i', range(5))
def test_foo(i): pass
""",
)

def test_zero_tests_collected(self, pytester: Pytester) -> None:
"""Some plugins (testmon for example) might issue pytest_runtest_logreport without any tests being
actually collected (#2971)."""
Expand Down Expand Up @@ -2185,6 +2200,26 @@ def test_timer(self, many_tests_files, pytester: Pytester) -> None:
]
)

def test_timer_multiline(
self, more_tests_files, monkeypatch, pytester: Pytester
) -> None:
monkeypatch.setenv("COLUMNS", "40")
pytester.makeini(
"""
[pytest]
console_output_style = timer
"""
)
output = pytester.runpytest()
output.stdout.re_match_lines(
[
r"test_bar.py ...................",
r"........... \s+ \d{1,3}[\.[a-z\ ]{1,2}\d{0,3}\w{1,2}$",
r"test_foo.py \.{5} \s+ \d{1,3}[\.[a-z\ ]{1,2}\d{0,3}\w{1,2}$",
],
consecutive=True
)

def test_verbose(self, many_tests_files, pytester: Pytester) -> None:
output = pytester.runpytest("-v")
output.stdout.re_match_lines(
Expand Down

0 comments on commit 9f666a4

Please sign in to comment.