Merge pull request #6576 from blueyed/test_via_exec
tests: add test_via_exec
This commit is contained in:
commit
a9eab07739
|
@ -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