Skip to content

Commit

Permalink
test: handle case where both pyargs and test file given (#510)
Browse files Browse the repository at this point in the history
* test: handle case where both pyargs and test file given
  • Loading branch information
iamogbz authored Jun 3, 2021
1 parent f73e7cd commit 3887151
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/integration/test_pytest_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,21 @@ def pytest_collect_file(path, parent):
def test_example(snapshot):
assert snapshot == 1
"""
testdir.makepyfile(conftest=conftest)
testdir.makeconftest(conftest)
testdir.makepyfile(test_file=testcase)
result = testdir.runpytest("test_file.py", "-v", "--snapshot-update")
result.stdout.re_match_lines((r".*test_file.py::CUSTOM.*"))
assert result.ret == 0


def test_handles_pyargs_non_module_when_both_given(testdir):
testdir.makeconftest("")
testcase = """
def test_example(snapshot):
assert snapshot == 1
"""
testdir.makepyfile(test_file=testcase)
result = testdir.runpytest(
"-v", "test_file.py", "--pyargs", "test_file", "--snapshot-update"
)
assert result.ret == 0
Empty file.

0 comments on commit 3887151

Please sign in to comment.