Merge pull request #6576 from blueyed/test_via_exec

tests: add test_via_exec
This commit is contained in:
Zac Hatfield-Dodds 2020-01-27 17:57:28 +11:00 committed by GitHub
commit a9eab07739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import py
import pytest
from _pytest.main import ExitCode
from _pytest.pytester import Testdir
from _pytest.reports import BaseReport
from _pytest.terminal import _folded_skips
from _pytest.terminal import _get_line_with_reprcrash_message
@ -1923,3 +1924,11 @@ def test_collecterror(testdir):
"*= 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 *"]
)