Fixed tests
This commit is contained in:
parent
272afa9422
commit
337f891d78
|
@ -26,7 +26,7 @@ def test_funcarg_prefix_deprecation(testdir):
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest('-ra')
|
result = testdir.runpytest('-ra')
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
('WC1 None pytest_funcarg__value: '
|
('pytest_funcarg__value: '
|
||||||
'declaring fixtures using "pytest_funcarg__" prefix is deprecated '
|
'declaring fixtures using "pytest_funcarg__" prefix is deprecated '
|
||||||
'and scheduled to be removed in pytest 4.0. '
|
'and scheduled to be removed in pytest 4.0. '
|
||||||
'Please remove the prefix and use the @pytest.fixture decorator instead.'),
|
'Please remove the prefix and use the @pytest.fixture decorator instead.'),
|
||||||
|
|
|
@ -975,7 +975,7 @@ def test_assert_tuple_warning(testdir):
|
||||||
assert(False, 'you shall not pass')
|
assert(False, 'you shall not pass')
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest('-rw')
|
result = testdir.runpytest('-rw')
|
||||||
result.stdout.fnmatch_lines('WR1*:2 assertion is always true*')
|
result.stdout.fnmatch_lines('*test_assert_tuple_warning.py:2 assertion is always true*')
|
||||||
|
|
||||||
def test_assert_indirect_tuple_no_warning(testdir):
|
def test_assert_indirect_tuple_no_warning(testdir):
|
||||||
testdir.makepyfile("""
|
testdir.makepyfile("""
|
||||||
|
|
|
@ -632,13 +632,14 @@ class TestWarning(object):
|
||||||
pass
|
pass
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest("--disable-pytest-warnings")
|
result = testdir.runpytest("--disable-pytest-warnings")
|
||||||
assert result.parseoutcomes()["pytest-warnings"] > 0
|
assert result.parseoutcomes()["warnings"] > 0
|
||||||
assert "hello" not in result.stdout.str()
|
assert "hello" not in result.stdout.str()
|
||||||
|
|
||||||
result = testdir.runpytest()
|
result = testdir.runpytest()
|
||||||
result.stdout.fnmatch_lines("""
|
result.stdout.fnmatch_lines("""
|
||||||
===*pytest-warning summary*===
|
===*warnings summary*===
|
||||||
*WT1*test_warn_on_test_item*:7 hello*
|
*test_warn_on_test_item_from_request::test_hello*
|
||||||
|
*hello*
|
||||||
""")
|
""")
|
||||||
|
|
||||||
class TestRootdir(object):
|
class TestRootdir(object):
|
||||||
|
|
|
@ -810,7 +810,10 @@ def test_record_property(testdir):
|
||||||
pnodes = psnode.find_by_tag('property')
|
pnodes = psnode.find_by_tag('property')
|
||||||
pnodes[0].assert_attr(name="bar", value="1")
|
pnodes[0].assert_attr(name="bar", value="1")
|
||||||
pnodes[1].assert_attr(name="foo", value="<1")
|
pnodes[1].assert_attr(name="foo", value="<1")
|
||||||
result.stdout.fnmatch_lines('*C3*test_record_property.py*experimental*')
|
result.stdout.fnmatch_lines([
|
||||||
|
'test_record_property.py::test_record',
|
||||||
|
'record_xml_property*experimental*',
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
def test_record_property_same_name(testdir):
|
def test_record_property_same_name(testdir):
|
||||||
|
|
|
@ -284,8 +284,8 @@ class TestPytestPluginManager(object):
|
||||||
result = testdir.runpytest("-rw", "-p", "skipping1", syspathinsert=True)
|
result = testdir.runpytest("-rw", "-p", "skipping1", syspathinsert=True)
|
||||||
assert result.ret == EXIT_NOTESTSCOLLECTED
|
assert result.ret == EXIT_NOTESTSCOLLECTED
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
"WI1*skipped plugin*skipping1*hello*",
|
"*skipped plugin*skipping1*hello*",
|
||||||
"WI1*skipped plugin*skipping2*hello*",
|
"*skipped plugin*skipping2*hello*",
|
||||||
])
|
])
|
||||||
|
|
||||||
def test_consider_env_plugin_instantiation(self, testdir, monkeypatch, pytestpm):
|
def test_consider_env_plugin_instantiation(self, testdir, monkeypatch, pytestpm):
|
||||||
|
|
|
@ -615,7 +615,7 @@ def test_getreportopt():
|
||||||
class config(object):
|
class config(object):
|
||||||
class option(object):
|
class option(object):
|
||||||
reportchars = ""
|
reportchars = ""
|
||||||
disablepytestwarnings = True
|
disable_warnings = True
|
||||||
|
|
||||||
config.option.reportchars = "sf"
|
config.option.reportchars = "sf"
|
||||||
assert getreportopt(config) == "sf"
|
assert getreportopt(config) == "sf"
|
||||||
|
@ -624,11 +624,11 @@ def test_getreportopt():
|
||||||
assert getreportopt(config) == "sfx"
|
assert getreportopt(config) == "sfx"
|
||||||
|
|
||||||
config.option.reportchars = "sfx"
|
config.option.reportchars = "sfx"
|
||||||
config.option.disablepytestwarnings = False
|
config.option.disable_warnings = False
|
||||||
assert getreportopt(config) == "sfxw"
|
assert getreportopt(config) == "sfxw"
|
||||||
|
|
||||||
config.option.reportchars = "sfxw"
|
config.option.reportchars = "sfxw"
|
||||||
config.option.disablepytestwarnings = False
|
config.option.disable_warnings = False
|
||||||
assert getreportopt(config) == "sfxw"
|
assert getreportopt(config) == "sfxw"
|
||||||
|
|
||||||
|
|
||||||
|
@ -837,8 +837,8 @@ def test_terminal_summary_warnings_are_displayed(testdir):
|
||||||
""")
|
""")
|
||||||
result = testdir.runpytest('-rw')
|
result = testdir.runpytest('-rw')
|
||||||
result.stdout.fnmatch_lines([
|
result.stdout.fnmatch_lines([
|
||||||
'*C1*internal warning',
|
'*internal warning',
|
||||||
'*== 1 pytest-warnings in *',
|
'*== 1 warnings in *',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -858,8 +858,8 @@ def test_terminal_summary_warnings_are_displayed(testdir):
|
||||||
("yellow", "1 weird", {"weird": (1,)}),
|
("yellow", "1 weird", {"weird": (1,)}),
|
||||||
("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}),
|
("yellow", "1 passed, 1 weird", {"weird": (1,), "passed": (1,)}),
|
||||||
|
|
||||||
("yellow", "1 pytest-warnings", {"warnings": (1,)}),
|
("yellow", "1 warnings", {"warnings": (1,)}),
|
||||||
("yellow", "1 passed, 1 pytest-warnings", {"warnings": (1,),
|
("yellow", "1 passed, 1 warnings", {"warnings": (1,),
|
||||||
"passed": (1,)}),
|
"passed": (1,)}),
|
||||||
|
|
||||||
("green", "5 passed", {"passed": (1,2,3,4,5)}),
|
("green", "5 passed", {"passed": (1,2,3,4,5)}),
|
||||||
|
|
|
@ -75,7 +75,6 @@ def test_setup_teardown_warnings(testdir, pyfile_with_warnings):
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('method', ['cmdline', 'ini'])
|
@pytest.mark.parametrize('method', ['cmdline', 'ini'])
|
||||||
def test_as_errors(testdir, pyfile_with_warnings, method):
|
def test_as_errors(testdir, pyfile_with_warnings, method):
|
||||||
args = ('-W', 'error') if method == 'cmdline' else ()
|
args = ('-W', 'error') if method == 'cmdline' else ()
|
||||||
|
|
Loading…
Reference in New Issue