Explain a bad scope value to the user

This commit is contained in:
Tyler Goodlet
2016-09-06 14:16:25 -04:00
parent 7660a19d0a
commit 6db2f315fa
6 changed files with 55 additions and 4 deletions

View File

@@ -1063,6 +1063,22 @@ class TestFixtureUsages:
"*1 error*"
])
def test_invalid_scope(self, testdir):
testdir.makepyfile("""
import pytest
@pytest.fixture(scope="functions")
def badscope():
pass
def test_nothing(badscope):
pass
""")
result = testdir.runpytest_inprocess()
result.stdout.fnmatch_lines(
("*ValueError: fixture badscope from test_invalid_scope.py has an unsupported"
" scope value 'functions'")
)
def test_funcarg_parametrized_and_used_twice(self, testdir):
testdir.makepyfile("""
import pytest