Skip to content

Commit 4beb78c

Browse files
Debian Science Teamrebecca-palmer
authored andcommitted
Don't require a warning armel numpy doesn't have
Author: Rebecca N. Palmer <[email protected]> Forwarded: no (this version requires dpkg) Gbp-Pq: Name armel_ignore_nonwarning.patch
1 parent d9dc120 commit 4beb78c

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

pandas/tests/apply/test_invalid_arg.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,12 @@ def test_transform_wont_agg_frame(axis, float_frame, func):
323323
with pytest.raises(ValueError, match=msg):
324324
float_frame.transform(func, axis=axis)
325325

326+
# armel numpy currently doesn't have the invalid log/sqrt warning (see 1.4.3-1 build log,
327+
# possibly the same underlying issue as statsmodels https://bugs.debian.org/956882)
328+
# using nullcontext() instead of warn=None to not start failing if this ever gets fixed
329+
import subprocess
330+
import contextlib
331+
debian_arch = subprocess.run(["dpkg","--print-architecture"],capture_output=True).stdout
326332

327333
@pytest.mark.parametrize("func", [["min", "max"], ["sqrt", "max"]])
328334
def test_transform_wont_agg_series(string_series, func):
@@ -333,7 +339,7 @@ def test_transform_wont_agg_series(string_series, func):
333339
warn = RuntimeWarning if func[0] == "sqrt" else None
334340
warn_msg = "invalid value encountered in sqrt"
335341
with pytest.raises(ValueError, match=msg):
336-
with tm.assert_produces_warning(warn, match=warn_msg, check_stacklevel=False):
342+
with (contextlib.nullcontext() if (debian_arch==b'armel\n') else tm.assert_produces_warning(warn, match=warn_msg, check_stacklevel=False)):
337343
string_series.transform(func)
338344

339345

pandas/tests/apply/test_str.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def test_apply_np_reducer(op, how):
7070
@pytest.mark.parametrize("how", ["transform", "apply"])
7171
def test_apply_np_transformer(float_frame, op, how):
7272
# GH 39116
73+
# armel numpy currently doesn't have the invalid log/sqrt warning (see 1.4.3-1 build log,
74+
# possibly the same underlying issue as statsmodels https://bugs.debian.org/956882)
75+
# using nullcontext() instead of warn=None to not start failing if this ever gets fixed
76+
import subprocess
77+
import contextlib
78+
debian_arch = subprocess.run(["dpkg","--print-architecture"],capture_output=True).stdout
7379

7480
# float_frame will _usually_ have negative values, which will
7581
# trigger the warning here, but let's put one in just to be sure
@@ -78,7 +84,7 @@ def test_apply_np_transformer(float_frame, op, how):
7884
if op in ["log", "sqrt"]:
7985
warn = RuntimeWarning
8086

81-
with tm.assert_produces_warning(warn, check_stacklevel=False):
87+
with (contextlib.nullcontext() if (debian_arch==b'armel\n') else tm.assert_produces_warning(warn, check_stacklevel=False)):
8288
# float_frame fixture is defined in conftest.py, so we don't check the
8389
# stacklevel as otherwise the test would fail.
8490
result = getattr(float_frame, how)(op)

pandas/tests/io/parser/test_c_parser_only.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ def test_delim_whitespace_custom_terminator(c_parser_only):
5656
expected = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=["a", "b", "c"])
5757
tm.assert_frame_equal(df, expected)
5858

59+
# armel numpy currently doesn't have some invalid warnings (see 2.0.3+dfsg-3 build log,
60+
# possibly the same underlying issue as statsmodels https://bugs.debian.org/956882)
61+
# using nullcontext() instead of warn=None to not start failing if this ever gets fixed
62+
import subprocess
63+
import contextlib
64+
debian_arch = subprocess.run(["dpkg","--print-architecture"],capture_output=True).stdout
5965

6066
def test_dtype_and_names_error(c_parser_only):
6167
# see gh-8833: passing both dtype and names
@@ -91,7 +97,7 @@ def test_dtype_and_names_error(c_parser_only):
9197
# fallback casting, but not castable
9298
warning = RuntimeWarning if np_version_gte1p24 else None
9399
with pytest.raises(ValueError, match="cannot safely convert"):
94-
with tm.assert_produces_warning(warning, check_stacklevel=False):
100+
with (contextlib.nullcontext() if (debian_arch==b'armel\n') else tm.assert_produces_warning(warning, check_stacklevel=False)):
95101
parser.read_csv(
96102
StringIO(data),
97103
sep=r"\s+",

0 commit comments

Comments
 (0)