Issue a warning when a fixture named 'request' is collected

Fix #611
This commit is contained in:
Bruno Oliveira
2018-10-20 12:09:44 -03:00
parent b432f1207c
commit 7bb51b8ceb
5 changed files with 37 additions and 2 deletions

View File

@@ -4,6 +4,8 @@ import os
import pytest
pytestmark = pytest.mark.pytester_example_path("deprecated")
@pytest.mark.filterwarnings("default")
def test_yield_tests_deprecation(testdir):
@@ -392,3 +394,13 @@ def test_pycollector_makeitem_is_deprecated():
with pytest.warns(RemovedInPytest4Warning):
collector.makeitem("foo", "bar")
assert collector.called
def test_fixture_named_request(testdir):
testdir.copy_example()
result = testdir.runpytest()
result.stdout.fnmatch_lines(
[
"*'request' is a reserved name for fixtures and will raise an error in future versions"
]
)