File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 2
2
import platform
3
3
import sys
4
4
5
+ import pytest
6
+
5
7
LINUX = sys .platform .startswith ("linux" )
6
8
MACOS = sys .platform .startswith ("darwin" )
7
9
WIN = sys .platform .startswith ("win32" ) or sys .platform .startswith ("cygwin" )
12
14
PY2 = sys .version_info .major == 2
13
15
14
16
PY = sys .version_info
17
+
18
+
19
+ def deprecated_call ():
20
+ """
21
+ pytest.deprecated_call() seems broken in pytest<3.9.x; concretely, it
22
+ doesn't work on CPython 3.8.0 with pytest==3.3.2 on Ubuntu 18.04 (#2922).
23
+
24
+ This is a narrowed reimplementation of the following PR :(
25
+ https://github.com/pytest-dev/pytest/pull/4104
26
+ """
27
+ # TODO: Remove this when testing requires pytest>=3.9.
28
+ pieces = pytest .__version__ .split ("." )
29
+ pytest_major_minor = (int (pieces [0 ]), int (pieces [1 ]))
30
+ if pytest_major_minor < (3 , 9 ):
31
+ return pytest .warns ((DeprecationWarning , PendingDeprecationWarning ))
32
+ else :
33
+ return pytest .deprecated_call ()
Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ def cant_convert(v):
301
301
cant_convert (3.14159 )
302
302
# TODO: Avoid DeprecationWarning in `PyLong_AsLong` (and similar)
303
303
if (3 , 8 ) <= env .PY < (3 , 10 ):
304
- with pytest .deprecated_call ():
304
+ with env .deprecated_call ():
305
305
assert convert (Int ()) == 42
306
306
else :
307
307
assert convert (Int ()) == 42
@@ -336,7 +336,7 @@ def require_implicit(v):
336
336
# The implicit conversion from np.float32 is undesirable but currently accepted.
337
337
# TODO: Avoid DeprecationWarning in `PyLong_AsLong` (and similar)
338
338
if (3 , 8 ) <= env .PY < (3 , 10 ):
339
- with pytest .deprecated_call ():
339
+ with env .deprecated_call ():
340
340
assert convert (np .float32 (3.14159 )) == 3
341
341
else :
342
342
assert convert (np .float32 (3.14159 )) == 3
You can’t perform that action at this time.
0 commit comments