tests: add test_via_exec
Via https://github.com/pytest-dev/pytest/issues/6574.
This commit is contained in:
parent
7c52a37d46
commit
40758e86ca
|
@ -13,6 +13,7 @@ import py
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.main import ExitCode
|
from _pytest.main import ExitCode
|
||||||
|
from _pytest.pytester import Testdir
|
||||||
from _pytest.reports import BaseReport
|
from _pytest.reports import BaseReport
|
||||||
from _pytest.terminal import _folded_skips
|
from _pytest.terminal import _folded_skips
|
||||||
from _pytest.terminal import _get_line_with_reprcrash_message
|
from _pytest.terminal import _get_line_with_reprcrash_message
|
||||||
|
@ -1923,3 +1924,11 @@ def test_collecterror(testdir):
|
||||||
"*= 1 error in *",
|
"*= 1 error in *",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_via_exec(testdir: Testdir) -> None:
|
||||||
|
p1 = testdir.makepyfile("exec('def test_via_exec(): pass')")
|
||||||
|
result = testdir.runpytest(str(p1), "-vv")
|
||||||
|
result.stdout.fnmatch_lines(
|
||||||
|
["test_via_exec.py::test_via_exec <- <string> PASSED*", "*= 1 passed in *"]
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue