Turn warnings into errors in pytest's own test suite

Fix #2588
This commit is contained in:
Bruno Oliveira
2017-07-20 23:11:14 -03:00
parent 1b732fe361
commit 0726d9a09f
9 changed files with 29 additions and 37 deletions

View File

@@ -12,6 +12,9 @@ from _pytest.main import (
)
ignore_parametrized_marks = pytest.mark.filterwarnings('ignore:Applying marks directly to parameters')
class TestModule(object):
def test_failing_import(self, testdir):
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
@@ -567,7 +570,8 @@ class TestFunction(object):
rec = testdir.inline_run()
rec.assertoutcome(passed=1)
def test_parametrize_with_mark(selfself, testdir):
@ignore_parametrized_marks
def test_parametrize_with_mark(self, testdir):
items = testdir.getitems("""
import pytest
@pytest.mark.foo
@@ -640,6 +644,7 @@ class TestFunction(object):
assert colitems[2].name == 'test2[a-c]'
assert colitems[3].name == 'test2[b-c]'
@ignore_parametrized_marks
def test_parametrize_skipif(self, testdir):
testdir.makepyfile("""
import pytest
@@ -653,6 +658,7 @@ class TestFunction(object):
result = testdir.runpytest()
result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
@ignore_parametrized_marks
def test_parametrize_skip(self, testdir):
testdir.makepyfile("""
import pytest
@@ -666,6 +672,7 @@ class TestFunction(object):
result = testdir.runpytest()
result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
@ignore_parametrized_marks
def test_parametrize_skipif_no_skip(self, testdir):
testdir.makepyfile("""
import pytest
@@ -679,6 +686,7 @@ class TestFunction(object):
result = testdir.runpytest()
result.stdout.fnmatch_lines('* 1 failed, 2 passed in *')
@ignore_parametrized_marks
def test_parametrize_xfail(self, testdir):
testdir.makepyfile("""
import pytest
@@ -692,6 +700,7 @@ class TestFunction(object):
result = testdir.runpytest()
result.stdout.fnmatch_lines('* 2 passed, 1 xfailed in *')
@ignore_parametrized_marks
def test_parametrize_passed(self, testdir):
testdir.makepyfile("""
import pytest
@@ -705,6 +714,7 @@ class TestFunction(object):
result = testdir.runpytest()
result.stdout.fnmatch_lines('* 2 passed, 1 xpassed in *')
@ignore_parametrized_marks
def test_parametrize_xfail_passed(self, testdir):
testdir.makepyfile("""
import pytest

View File

@@ -1289,8 +1289,9 @@ class TestMetafuncFunctionalAuto(object):
assert output.count('preparing foo-3') == 1
@pytest.mark.filterwarnings('ignore:Applying marks directly to parameters')
@pytest.mark.issue308
class TestMarkersWithParametrization(object):
pytestmark = pytest.mark.issue308
def test_simple_mark(self, testdir):
s = """

View File

@@ -187,7 +187,7 @@ def test_dynamic_fixture_request(testdir):
pass
@pytest.fixture()
def dependent_fixture(request):
request.getfuncargvalue('dynamically_requested_fixture')
request.getfixturevalue('dynamically_requested_fixture')
def test_dyn(dependent_fixture):
pass
''')