Skip to content

Commit 0adc0e6

Browse files
committed
Fix test for py37
In previous Python versions, the list of warnigns appears like: ... list of emitted warnings is: [UserWarning('user',)]. In Python 3.7 apparently the string representation has been improved to: ... list of emitted warnings is: [UserWarning('user')]. Fix pytest-dev#3011
1 parent 3bc7ced commit 0adc0e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

testing/test_recwarn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ def test_as_contextmanager(self):
205205
with pytest.raises(pytest.fail.Exception) as excinfo:
206206
with pytest.warns(RuntimeWarning):
207207
warnings.warn("user", UserWarning)
208-
excinfo.match(r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. "
209-
r"The list of emitted warnings is: \[UserWarning\('user',\)\].")
208+
excinfo.match(r"DID NOT WARN. No warningas of type \(.+RuntimeWarning.+,\) was emitted. "
209+
r"The list of emitted warnings is: \[UserWarning\('user',?\)\].")
210210

211211
with pytest.raises(pytest.fail.Exception) as excinfo:
212212
with pytest.warns(UserWarning):
213213
warnings.warn("runtime", RuntimeWarning)
214214
excinfo.match(r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. "
215-
r"The list of emitted warnings is: \[RuntimeWarning\('runtime',\)\].")
215+
r"The list of emitted warnings is: \[RuntimeWarning\('runtime',?\)\].")
216216

217217
with pytest.raises(pytest.fail.Exception) as excinfo:
218218
with pytest.warns(UserWarning):

0 commit comments

Comments
 (0)