Skip to content

Commit fd64fa1

Browse files
committed
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
1 parent 56dc01f commit fd64fa1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

testing/test_pluginmanager.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from __future__ import print_function
55

66
import os
7-
import re
87
import sys
98
import types
109

@@ -165,10 +164,10 @@ def test_traceback():
165164
with pytest.raises(ImportError) as excinfo:
166165
pytestpm.import_plugin("qwe")
167166

168-
expected_message = '.*Error importing plugin "qwe": Not possible to import: .'
169-
expected_traceback = ".*in test_traceback"
170-
assert re.match(expected_message, str(excinfo.value))
171-
assert re.match(expected_traceback, str(excinfo.traceback[-1]))
167+
assert str(excinfo.value).endswith(
168+
'Error importing plugin "qwe": Not possible to import: ☺'
169+
)
170+
assert "in test_traceback" in str(excinfo.traceback[-1])
172171

173172

174173
class TestPytestPluginManager(object):

0 commit comments

Comments
 (0)