Skip to content

Commit f86bd5a

Browse files
author
Jakub Urban
committed
fixed tests for pytest 5
1 parent 73bdc1e commit f86bd5a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/test_importer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ def test_invalid_format():
77
with pytest.raises(ImportFromStringError) as exc:
88
import_from_string("example:")
99
expected = 'Import string "example:" must be in format "<module>:<attribute>".'
10-
assert expected in str(exc)
10+
assert exc.match(expected)
1111

1212

1313
def test_invalid_module():
1414
with pytest.raises(ImportFromStringError) as exc:
1515
import_from_string("module_does_not_exist:myattr")
1616
expected = 'Could not import module "module_does_not_exist".'
17-
assert expected in str(exc)
17+
assert exc.match(expected)
1818

1919

2020
def test_invalid_attr():
2121
with pytest.raises(ImportFromStringError) as exc:
2222
import_from_string("tempfile:attr_does_not_exist")
2323
expected = 'Attribute "attr_does_not_exist" not found in module "tempfile".'
24-
assert expected in str(exc)
24+
assert exc.match(expected)
2525

2626

2727
def test_internal_import_error():

0 commit comments

Comments
 (0)