From fd64fa1863e347246b9f9bf0a0e3dd7af5f6284b Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 22 Mar 2019 16:56:00 +0100 Subject: [PATCH] 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 --- testing/test_pluginmanager.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 6b44f3e0c..10b54c112 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -4,7 +4,6 @@ from __future__ import division from __future__ import print_function import os -import re import sys import types @@ -165,10 +164,10 @@ def test_importplugin_error_message(testdir, pytestpm): with pytest.raises(ImportError) as excinfo: pytestpm.import_plugin("qwe") - expected_message = '.*Error importing plugin "qwe": Not possible to import: .' - expected_traceback = ".*in test_traceback" - assert re.match(expected_message, str(excinfo.value)) - assert re.match(expected_traceback, str(excinfo.traceback[-1])) + assert str(excinfo.value).endswith( + 'Error importing plugin "qwe": Not possible to import: ☺' + ) + assert "in test_traceback" in str(excinfo.traceback[-1]) class TestPytestPluginManager(object):