Merge pull request #2599 from nicoddemus/turn-warnings-into-errors
Turn warnings into errors WIP, waiting #2598
This commit is contained in:
commit
309152d9fd
|
@ -11,12 +11,9 @@ env:
|
||||||
- TOXENV=coveralls
|
- TOXENV=coveralls
|
||||||
# note: please use "tox --listenvs" to populate the build matrix below
|
# note: please use "tox --listenvs" to populate the build matrix below
|
||||||
- TOXENV=linting
|
- TOXENV=linting
|
||||||
- TOXENV=py26
|
|
||||||
- TOXENV=py27
|
- TOXENV=py27
|
||||||
- TOXENV=py33
|
|
||||||
- TOXENV=py34
|
- TOXENV=py34
|
||||||
- TOXENV=py35
|
- TOXENV=py35
|
||||||
- TOXENV=pypy
|
|
||||||
- TOXENV=py27-pexpect
|
- TOXENV=py27-pexpect
|
||||||
- TOXENV=py27-xdist
|
- TOXENV=py27-xdist
|
||||||
- TOXENV=py27-trial
|
- TOXENV=py27-trial
|
||||||
|
@ -32,6 +29,12 @@ env:
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- env: TOXENV=py26
|
||||||
|
python: '2.6'
|
||||||
|
- env: TOXENV=py33
|
||||||
|
python: '3.3'
|
||||||
|
- env: TOXENV=pypy
|
||||||
|
python: 'pypy-5.4'
|
||||||
- env: TOXENV=py36
|
- env: TOXENV=py36
|
||||||
python: '3.6'
|
python: '3.6'
|
||||||
- env: TOXENV=py37
|
- env: TOXENV=py37
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Turn warnings into errors in pytest's own test suite in order to catch regressions due to deprecations more promptly.
|
|
@ -12,6 +12,9 @@ from _pytest.main import (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
ignore_parametrized_marks = pytest.mark.filterwarnings('ignore:Applying marks directly to parameters')
|
||||||
|
|
||||||
|
|
||||||
class TestModule(object):
|
class TestModule(object):
|
||||||
def test_failing_import(self, testdir):
|
def test_failing_import(self, testdir):
|
||||||
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
|
modcol = testdir.getmodulecol("import alksdjalskdjalkjals")
|
||||||
|
@ -567,7 +570,8 @@ class TestFunction(object):
|
||||||
rec = testdir.inline_run()
|
rec = testdir.inline_run()
|
||||||
rec.assertoutcome(passed=1)
|
rec.assertoutcome(passed=1)
|
||||||
|
|
||||||
def test_parametrize_with_mark(selfself, testdir):
|
@ignore_parametrized_marks
|
||||||
|
def test_parametrize_with_mark(self, testdir):
|
||||||
items = testdir.getitems("""
|
items = testdir.getitems("""
|
||||||
import pytest
|
import pytest
|
||||||
@pytest.mark.foo
|
@pytest.mark.foo
|
||||||
|
@ -640,6 +644,7 @@ class TestFunction(object):
|
||||||
assert colitems[2].name == 'test2[a-c]'
|
assert colitems[2].name == 'test2[a-c]'
|
||||||
assert colitems[3].name == 'test2[b-c]'
|
assert colitems[3].name == 'test2[b-c]'
|
||||||
|
|
||||||
|
@ignore_parametrized_marks
|
||||||
def test_parametrize_skipif(self, testdir):
|
def test_parametrize_skipif(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -653,6 +658,7 @@ class TestFunction(object):
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
|
result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
|
||||||
|
|
||||||
|
@ignore_parametrized_marks
|
||||||
def test_parametrize_skip(self, testdir):
|
def test_parametrize_skip(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -666,6 +672,7 @@ class TestFunction(object):
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
|
result.stdout.fnmatch_lines('* 2 passed, 1 skipped in *')
|
||||||
|
|
||||||
|
@ignore_parametrized_marks
|
||||||
def test_parametrize_skipif_no_skip(self, testdir):
|
def test_parametrize_skipif_no_skip(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -679,6 +686,7 @@ class TestFunction(object):
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
result.stdout.fnmatch_lines('* 1 failed, 2 passed in *')
|
result.stdout.fnmatch_lines('* 1 failed, 2 passed in *')
|
||||||
|
|
||||||
|
@ignore_parametrized_marks
|
||||||
def test_parametrize_xfail(self, testdir):
|
def test_parametrize_xfail(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -692,6 +700,7 @@ class TestFunction(object):
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
result.stdout.fnmatch_lines('* 2 passed, 1 xfailed in *')
|
result.stdout.fnmatch_lines('* 2 passed, 1 xfailed in *')
|
||||||
|
|
||||||
|
@ignore_parametrized_marks
|
||||||
def test_parametrize_passed(self, testdir):
|
def test_parametrize_passed(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -705,6 +714,7 @@ class TestFunction(object):
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
result.stdout.fnmatch_lines('* 2 passed, 1 xpassed in *')
|
result.stdout.fnmatch_lines('* 2 passed, 1 xpassed in *')
|
||||||
|
|
||||||
|
@ignore_parametrized_marks
|
||||||
def test_parametrize_xfail_passed(self, testdir):
|
def test_parametrize_xfail_passed(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
import pytest
|
import pytest
|
||||||
|
|
|
@ -1289,8 +1289,9 @@ class TestMetafuncFunctionalAuto(object):
|
||||||
assert output.count('preparing foo-3') == 1
|
assert output.count('preparing foo-3') == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.filterwarnings('ignore:Applying marks directly to parameters')
|
||||||
|
@pytest.mark.issue308
|
||||||
class TestMarkersWithParametrization(object):
|
class TestMarkersWithParametrization(object):
|
||||||
pytestmark = pytest.mark.issue308
|
|
||||||
|
|
||||||
def test_simple_mark(self, testdir):
|
def test_simple_mark(self, testdir):
|
||||||
s = """
|
s = """
|
||||||
|
|
|
@ -187,7 +187,7 @@ def test_dynamic_fixture_request(testdir):
|
||||||
pass
|
pass
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def dependent_fixture(request):
|
def dependent_fixture(request):
|
||||||
request.getfuncargvalue('dynamically_requested_fixture')
|
request.getfixturevalue('dynamically_requested_fixture')
|
||||||
def test_dyn(dependent_fixture):
|
def test_dyn(dependent_fixture):
|
||||||
pass
|
pass
|
||||||
''')
|
''')
|
||||||
|
|
|
@ -787,6 +787,7 @@ class TestKeywordSelection(object):
|
||||||
marks=[pytest.mark.xfail, pytest.mark.skip], id=None)),
|
marks=[pytest.mark.xfail, pytest.mark.skip], id=None)),
|
||||||
|
|
||||||
])
|
])
|
||||||
|
@pytest.mark.filterwarnings('ignore')
|
||||||
def test_parameterset_extractfrom(argval, expected):
|
def test_parameterset_extractfrom(argval, expected):
|
||||||
extracted = ParameterSet.extract_from(argval)
|
extracted = ParameterSet.extract_from(argval)
|
||||||
assert extracted == expected
|
assert extracted == expected
|
||||||
|
|
|
@ -2,7 +2,6 @@ from __future__ import absolute_import, division, print_function
|
||||||
import warnings
|
import warnings
|
||||||
import re
|
import re
|
||||||
import py
|
import py
|
||||||
import sys
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from _pytest.recwarn import WarningsRecorder
|
from _pytest.recwarn import WarningsRecorder
|
||||||
|
@ -125,6 +124,7 @@ class TestDeprecatedCall(object):
|
||||||
@pytest.mark.parametrize('warning_type', [PendingDeprecationWarning, DeprecationWarning])
|
@pytest.mark.parametrize('warning_type', [PendingDeprecationWarning, DeprecationWarning])
|
||||||
@pytest.mark.parametrize('mode', ['context_manager', 'call'])
|
@pytest.mark.parametrize('mode', ['context_manager', 'call'])
|
||||||
@pytest.mark.parametrize('call_f_first', [True, False])
|
@pytest.mark.parametrize('call_f_first', [True, False])
|
||||||
|
@pytest.mark.filterwarnings('ignore')
|
||||||
def test_deprecated_call_modes(self, warning_type, mode, call_f_first):
|
def test_deprecated_call_modes(self, warning_type, mode, call_f_first):
|
||||||
"""Ensure deprecated_call() captures a deprecation warning as expected inside its
|
"""Ensure deprecated_call() captures a deprecation warning as expected inside its
|
||||||
block/function.
|
block/function.
|
||||||
|
@ -170,32 +170,6 @@ class TestDeprecatedCall(object):
|
||||||
with pytest.deprecated_call():
|
with pytest.deprecated_call():
|
||||||
f()
|
f()
|
||||||
|
|
||||||
def test_deprecated_function_already_called(self, testdir):
|
|
||||||
"""deprecated_call should be able to catch a call to a deprecated
|
|
||||||
function even if that function has already been called in the same
|
|
||||||
module. See #1190.
|
|
||||||
"""
|
|
||||||
testdir.makepyfile("""
|
|
||||||
import warnings
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
def deprecated_function():
|
|
||||||
warnings.warn("deprecated", DeprecationWarning)
|
|
||||||
|
|
||||||
def test_one():
|
|
||||||
deprecated_function()
|
|
||||||
|
|
||||||
def test_two():
|
|
||||||
pytest.deprecated_call(deprecated_function)
|
|
||||||
""")
|
|
||||||
result = testdir.runpytest()
|
|
||||||
# for some reason in py26 catch_warnings manages to catch the deprecation warning
|
|
||||||
# from deprecated_function(), even with default filters active (which ignore deprecation
|
|
||||||
# warnings)
|
|
||||||
py26 = sys.version_info[:2] == (2, 6)
|
|
||||||
expected = '*=== 2 passed in *===' if not py26 else '*=== 2 passed, 1 warnings in *==='
|
|
||||||
result.stdout.fnmatch_lines(expected)
|
|
||||||
|
|
||||||
|
|
||||||
class TestWarns(object):
|
class TestWarns(object):
|
||||||
def test_strings(self):
|
def test_strings(self):
|
||||||
|
|
|
@ -9,9 +9,9 @@ def test_simple_unittest(testdir):
|
||||||
import unittest
|
import unittest
|
||||||
class MyTestCase(unittest.TestCase):
|
class MyTestCase(unittest.TestCase):
|
||||||
def testpassing(self):
|
def testpassing(self):
|
||||||
self.assertEquals('foo', 'foo')
|
self.assertEqual('foo', 'foo')
|
||||||
def test_failing(self):
|
def test_failing(self):
|
||||||
self.assertEquals('foo', 'bar')
|
self.assertEqual('foo', 'bar')
|
||||||
""")
|
""")
|
||||||
reprec = testdir.inline_run(testpath)
|
reprec = testdir.inline_run(testpath)
|
||||||
assert reprec.matchreport("testpassing").passed
|
assert reprec.matchreport("testpassing").passed
|
||||||
|
@ -23,10 +23,10 @@ def test_runTest_method(testdir):
|
||||||
import unittest
|
import unittest
|
||||||
class MyTestCaseWithRunTest(unittest.TestCase):
|
class MyTestCaseWithRunTest(unittest.TestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
self.assertEquals('foo', 'foo')
|
self.assertEqual('foo', 'foo')
|
||||||
class MyTestCaseWithoutRunTest(unittest.TestCase):
|
class MyTestCaseWithoutRunTest(unittest.TestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
self.assertEquals('foo', 'foo')
|
self.assertEqual('foo', 'foo')
|
||||||
def test_something(self):
|
def test_something(self):
|
||||||
pass
|
pass
|
||||||
""")
|
""")
|
||||||
|
@ -59,7 +59,7 @@ def test_setup(testdir):
|
||||||
def setup_method(self, method):
|
def setup_method(self, method):
|
||||||
self.foo2 = 1
|
self.foo2 = 1
|
||||||
def test_both(self):
|
def test_both(self):
|
||||||
self.assertEquals(1, self.foo)
|
self.assertEqual(1, self.foo)
|
||||||
assert self.foo2 == 1
|
assert self.foo2 == 1
|
||||||
def teardown_method(self, method):
|
def teardown_method(self, method):
|
||||||
assert 0, "42"
|
assert 0, "42"
|
||||||
|
@ -136,7 +136,7 @@ def test_teardown(testdir):
|
||||||
self.l.append(None)
|
self.l.append(None)
|
||||||
class Second(unittest.TestCase):
|
class Second(unittest.TestCase):
|
||||||
def test_check(self):
|
def test_check(self):
|
||||||
self.assertEquals(MyTestCase.l, [None])
|
self.assertEqual(MyTestCase.l, [None])
|
||||||
""")
|
""")
|
||||||
reprec = testdir.inline_run(testpath)
|
reprec = testdir.inline_run(testpath)
|
||||||
passed, skipped, failed = reprec.countoutcomes()
|
passed, skipped, failed = reprec.countoutcomes()
|
||||||
|
@ -351,61 +351,12 @@ def test_module_level_pytestmark(testdir):
|
||||||
reprec.assertoutcome(skipped=1)
|
reprec.assertoutcome(skipped=1)
|
||||||
|
|
||||||
|
|
||||||
def test_trial_testcase_skip_property(testdir):
|
|
||||||
pytest.importorskip('twisted.trial.unittest')
|
|
||||||
testpath = testdir.makepyfile("""
|
|
||||||
from twisted.trial import unittest
|
|
||||||
class MyTestCase(unittest.TestCase):
|
|
||||||
skip = 'dont run'
|
|
||||||
def test_func(self):
|
|
||||||
pass
|
|
||||||
""")
|
|
||||||
reprec = testdir.inline_run(testpath, "-s")
|
|
||||||
reprec.assertoutcome(skipped=1)
|
|
||||||
|
|
||||||
|
|
||||||
def test_trial_testfunction_skip_property(testdir):
|
|
||||||
pytest.importorskip('twisted.trial.unittest')
|
|
||||||
testpath = testdir.makepyfile("""
|
|
||||||
from twisted.trial import unittest
|
|
||||||
class MyTestCase(unittest.TestCase):
|
|
||||||
def test_func(self):
|
|
||||||
pass
|
|
||||||
test_func.skip = 'dont run'
|
|
||||||
""")
|
|
||||||
reprec = testdir.inline_run(testpath, "-s")
|
|
||||||
reprec.assertoutcome(skipped=1)
|
|
||||||
|
|
||||||
|
|
||||||
def test_trial_testcase_todo_property(testdir):
|
|
||||||
pytest.importorskip('twisted.trial.unittest')
|
|
||||||
testpath = testdir.makepyfile("""
|
|
||||||
from twisted.trial import unittest
|
|
||||||
class MyTestCase(unittest.TestCase):
|
|
||||||
todo = 'dont run'
|
|
||||||
def test_func(self):
|
|
||||||
assert 0
|
|
||||||
""")
|
|
||||||
reprec = testdir.inline_run(testpath, "-s")
|
|
||||||
reprec.assertoutcome(skipped=1)
|
|
||||||
|
|
||||||
|
|
||||||
def test_trial_testfunction_todo_property(testdir):
|
|
||||||
pytest.importorskip('twisted.trial.unittest')
|
|
||||||
testpath = testdir.makepyfile("""
|
|
||||||
from twisted.trial import unittest
|
|
||||||
class MyTestCase(unittest.TestCase):
|
|
||||||
def test_func(self):
|
|
||||||
assert 0
|
|
||||||
test_func.todo = 'dont run'
|
|
||||||
""")
|
|
||||||
reprec = testdir.inline_run(testpath, "-s")
|
|
||||||
reprec.assertoutcome(skipped=1)
|
|
||||||
|
|
||||||
|
|
||||||
class TestTrialUnittest(object):
|
class TestTrialUnittest(object):
|
||||||
def setup_class(cls):
|
def setup_class(cls):
|
||||||
cls.ut = pytest.importorskip("twisted.trial.unittest")
|
cls.ut = pytest.importorskip("twisted.trial.unittest")
|
||||||
|
# on windows trial uses a socket for a reactor and apparently doesn't close it properly
|
||||||
|
# https://twistedmatrix.com/trac/ticket/9227
|
||||||
|
cls.ignore_unclosed_socket_warning = ('-W', 'always')
|
||||||
|
|
||||||
def test_trial_testcase_runtest_not_collected(self, testdir):
|
def test_trial_testcase_runtest_not_collected(self, testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
@ -415,7 +366,7 @@ class TestTrialUnittest(object):
|
||||||
def test_hello(self):
|
def test_hello(self):
|
||||||
pass
|
pass
|
||||||
""")
|
""")
|
||||||
reprec = testdir.inline_run()
|
reprec = testdir.inline_run(*self.ignore_unclosed_socket_warning)
|
||||||
reprec.assertoutcome(passed=1)
|
reprec.assertoutcome(passed=1)
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
from twisted.trial.unittest import TestCase
|
from twisted.trial.unittest import TestCase
|
||||||
|
@ -424,7 +375,7 @@ class TestTrialUnittest(object):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
pass
|
pass
|
||||||
""")
|
""")
|
||||||
reprec = testdir.inline_run()
|
reprec = testdir.inline_run(*self.ignore_unclosed_socket_warning)
|
||||||
reprec.assertoutcome(passed=1)
|
reprec.assertoutcome(passed=1)
|
||||||
|
|
||||||
def test_trial_exceptions_with_skips(self, testdir):
|
def test_trial_exceptions_with_skips(self, testdir):
|
||||||
|
@ -462,7 +413,7 @@ class TestTrialUnittest(object):
|
||||||
""")
|
""")
|
||||||
from _pytest.compat import _is_unittest_unexpected_success_a_failure
|
from _pytest.compat import _is_unittest_unexpected_success_a_failure
|
||||||
should_fail = _is_unittest_unexpected_success_a_failure()
|
should_fail = _is_unittest_unexpected_success_a_failure()
|
||||||
result = testdir.runpytest("-rxs")
|
result = testdir.runpytest("-rxs", *self.ignore_unclosed_socket_warning)
|
||||||
result.stdout.fnmatch_lines_random([
|
result.stdout.fnmatch_lines_random([
|
||||||
"*XFAIL*test_trial_todo*",
|
"*XFAIL*test_trial_todo*",
|
||||||
"*trialselfskip*",
|
"*trialselfskip*",
|
||||||
|
@ -537,6 +488,50 @@ class TestTrialUnittest(object):
|
||||||
child.expect("hellopdb")
|
child.expect("hellopdb")
|
||||||
child.sendeof()
|
child.sendeof()
|
||||||
|
|
||||||
|
def test_trial_testcase_skip_property(self, testdir):
|
||||||
|
testpath = testdir.makepyfile("""
|
||||||
|
from twisted.trial import unittest
|
||||||
|
class MyTestCase(unittest.TestCase):
|
||||||
|
skip = 'dont run'
|
||||||
|
def test_func(self):
|
||||||
|
pass
|
||||||
|
""")
|
||||||
|
reprec = testdir.inline_run(testpath, "-s")
|
||||||
|
reprec.assertoutcome(skipped=1)
|
||||||
|
|
||||||
|
def test_trial_testfunction_skip_property(self, testdir):
|
||||||
|
testpath = testdir.makepyfile("""
|
||||||
|
from twisted.trial import unittest
|
||||||
|
class MyTestCase(unittest.TestCase):
|
||||||
|
def test_func(self):
|
||||||
|
pass
|
||||||
|
test_func.skip = 'dont run'
|
||||||
|
""")
|
||||||
|
reprec = testdir.inline_run(testpath, "-s")
|
||||||
|
reprec.assertoutcome(skipped=1)
|
||||||
|
|
||||||
|
def test_trial_testcase_todo_property(self, testdir):
|
||||||
|
testpath = testdir.makepyfile("""
|
||||||
|
from twisted.trial import unittest
|
||||||
|
class MyTestCase(unittest.TestCase):
|
||||||
|
todo = 'dont run'
|
||||||
|
def test_func(self):
|
||||||
|
assert 0
|
||||||
|
""")
|
||||||
|
reprec = testdir.inline_run(testpath, "-s")
|
||||||
|
reprec.assertoutcome(skipped=1)
|
||||||
|
|
||||||
|
def test_trial_testfunction_todo_property(self, testdir):
|
||||||
|
testpath = testdir.makepyfile("""
|
||||||
|
from twisted.trial import unittest
|
||||||
|
class MyTestCase(unittest.TestCase):
|
||||||
|
def test_func(self):
|
||||||
|
assert 0
|
||||||
|
test_func.todo = 'dont run'
|
||||||
|
""")
|
||||||
|
reprec = testdir.inline_run(testpath, "-s", *self.ignore_unclosed_socket_warning)
|
||||||
|
reprec.assertoutcome(skipped=1)
|
||||||
|
|
||||||
|
|
||||||
def test_djangolike_testcase(testdir):
|
def test_djangolike_testcase(testdir):
|
||||||
# contributed from Morten Breekevold
|
# contributed from Morten Breekevold
|
||||||
|
@ -598,7 +593,7 @@ def test_unittest_not_shown_in_traceback(testdir):
|
||||||
class t(unittest.TestCase):
|
class t(unittest.TestCase):
|
||||||
def test_hello(self):
|
def test_hello(self):
|
||||||
x = 3
|
x = 3
|
||||||
self.assertEquals(x, 4)
|
self.assertEqual(x, 4)
|
||||||
""")
|
""")
|
||||||
res = testdir.runpytest()
|
res = testdir.runpytest()
|
||||||
assert "failUnlessEqual" not in res.stdout.str()
|
assert "failUnlessEqual" not in res.stdout.str()
|
||||||
|
|
|
@ -33,6 +33,7 @@ def pyfile_with_warnings(testdir, request):
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.filterwarnings('always')
|
||||||
def test_normal_flow(testdir, pyfile_with_warnings):
|
def test_normal_flow(testdir, pyfile_with_warnings):
|
||||||
"""
|
"""
|
||||||
Check that the warnings section is displayed, containing test node ids followed by
|
Check that the warnings section is displayed, containing test node ids followed by
|
||||||
|
@ -54,6 +55,7 @@ def test_normal_flow(testdir, pyfile_with_warnings):
|
||||||
assert result.stdout.str().count('test_normal_flow.py::test_func') == 1
|
assert result.stdout.str().count('test_normal_flow.py::test_func') == 1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.filterwarnings('always')
|
||||||
def test_setup_teardown_warnings(testdir, pyfile_with_warnings):
|
def test_setup_teardown_warnings(testdir, pyfile_with_warnings):
|
||||||
testdir.makepyfile('''
|
testdir.makepyfile('''
|
||||||
import warnings
|
import warnings
|
||||||
|
@ -115,6 +117,7 @@ def test_ignore(testdir, pyfile_with_warnings, method):
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 0),
|
@pytest.mark.skipif(sys.version_info < (3, 0),
|
||||||
reason='warnings message is unicode is ok in python3')
|
reason='warnings message is unicode is ok in python3')
|
||||||
|
@pytest.mark.filterwarnings('always')
|
||||||
def test_unicode(testdir, pyfile_with_warnings):
|
def test_unicode(testdir, pyfile_with_warnings):
|
||||||
testdir.makepyfile('''
|
testdir.makepyfile('''
|
||||||
# -*- coding: utf8 -*-
|
# -*- coding: utf8 -*-
|
||||||
|
@ -152,6 +155,7 @@ def test_py2_unicode(testdir, pyfile_with_warnings):
|
||||||
warnings.warn(u"测试")
|
warnings.warn(u"测试")
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
@pytest.mark.filterwarnings('always')
|
||||||
def test_func(fix):
|
def test_func(fix):
|
||||||
pass
|
pass
|
||||||
''')
|
''')
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -193,6 +193,7 @@ python_classes = Test Acceptance
|
||||||
python_functions = test
|
python_functions = test
|
||||||
norecursedirs = .tox ja .hg cx_freeze_source
|
norecursedirs = .tox ja .hg cx_freeze_source
|
||||||
filterwarnings =
|
filterwarnings =
|
||||||
|
error
|
||||||
# produced by path.local
|
# produced by path.local
|
||||||
ignore:bad escape.*:DeprecationWarning:re
|
ignore:bad escape.*:DeprecationWarning:re
|
||||||
# produced by path.readlines
|
# produced by path.readlines
|
||||||
|
|
Loading…
Reference in New Issue