Skip to content

Commit 40758e8

Browse files
committed
tests: add test_via_exec
Via #6574.
1 parent 7c52a37 commit 40758e8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

testing/test_terminal.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import pytest
1515
from _pytest.main import ExitCode
16+
from _pytest.pytester import Testdir
1617
from _pytest.reports import BaseReport
1718
from _pytest.terminal import _folded_skips
1819
from _pytest.terminal import _get_line_with_reprcrash_message
@@ -1923,3 +1924,11 @@ def test_collecterror(testdir):
19231924
"*= 1 error in *",
19241925
]
19251926
)
1927+
1928+
1929+
def test_via_exec(testdir: Testdir) -> None:
1930+
p1 = testdir.makepyfile("exec('def test_via_exec(): pass')")
1931+
result = testdir.runpytest(str(p1), "-vv")
1932+
result.stdout.fnmatch_lines(
1933+
["test_via_exec.py::test_via_exec <- <string> PASSED*", "*= 1 passed in *"]
1934+
)

0 commit comments

Comments
 (0)