Skip to content

Commit 3745430

Browse files
committed
Skip .match on older pytest (pre-3.0)
Fixes test failure on Fedora 25.
1 parent 1990617 commit 3745430

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_kwargs_and_defaults.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ def test_named_arguments(msg):
3434
with pytest.raises(TypeError) as excinfo:
3535
# noinspection PyArgumentList
3636
kw_func2(x=5, y=10, z=12)
37-
assert excinfo.match(
38-
r'(?s)^kw_func2\(\): incompatible.*Invoked with: kwargs: ((x=5|y=10|z=12)(, |$))' + '{3}$')
37+
if hasattr(excinfo, "match"): # (pytest <3.0 doesn't have `.match()`)
38+
assert excinfo.match(
39+
r'(?s)^kw_func2\(\): incompatible.*Invoked with: kwargs: ((x=5|y=10|z=12)(, |$))' +
40+
'{3}$')
3941

4042
assert kw_func4() == "{13 17}"
4143
assert kw_func4(myList=[1, 2, 3]) == "{1 2 3}"

0 commit comments

Comments
 (0)