Revisit test_importplugin_error_message
Should be more helpful in case of errors than before: > assert re.match(expected_message, str(excinfo.value)) E _pytest.warning_types.PytestWarning: asserting the value None, please use "assert is None" https://travis-ci.org/pytest-dev/pytest/jobs/509970576#L208
This commit is contained in:
parent
56dc01ffe0
commit
fd64fa1863
|
@ -4,7 +4,6 @@ from __future__ import division
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
import types
|
import types
|
||||||
|
|
||||||
|
@ -165,10 +164,10 @@ def test_importplugin_error_message(testdir, pytestpm):
|
||||||
with pytest.raises(ImportError) as excinfo:
|
with pytest.raises(ImportError) as excinfo:
|
||||||
pytestpm.import_plugin("qwe")
|
pytestpm.import_plugin("qwe")
|
||||||
|
|
||||||
expected_message = '.*Error importing plugin "qwe": Not possible to import: .'
|
assert str(excinfo.value).endswith(
|
||||||
expected_traceback = ".*in test_traceback"
|
'Error importing plugin "qwe": Not possible to import: ☺'
|
||||||
assert re.match(expected_message, str(excinfo.value))
|
)
|
||||||
assert re.match(expected_traceback, str(excinfo.traceback[-1]))
|
assert "in test_traceback" in str(excinfo.traceback[-1])
|
||||||
|
|
||||||
|
|
||||||
class TestPytestPluginManager(object):
|
class TestPytestPluginManager(object):
|
||||||
|
|
Loading…
Reference in New Issue