Don't require a warning armel numpy doesn't have
authorDebian Science Team <debian-science-maintainers@lists.alioth.debian.org>
Fri, 9 Feb 2024 20:48:14 +0000 (20:48 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Fri, 9 Feb 2024 20:48:14 +0000 (20:48 +0000)
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: no (this version requires dpkg)

Gbp-Pq: Name armel_ignore_nonwarning.patch

pandas/tests/apply/test_invalid_arg.py
pandas/tests/apply/test_str.py
pandas/tests/io/parser/test_c_parser_only.py

index a3d9de5e78afb88a7f14b8ab6c8f45d8ab80fbbf..84f74eb73be4d2588aa939c6be7f77d216edc8ae 100644 (file)
@@ -323,6 +323,12 @@ def test_transform_wont_agg_frame(axis, float_frame, func):
     with pytest.raises(ValueError, match=msg):
         float_frame.transform(func, axis=axis)
 
+# armel numpy currently doesn't have the invalid log/sqrt warning (see 1.4.3-1 build log,
+# possibly the same underlying issue as statsmodels https://bugs.debian.org/956882)
+# using nullcontext() instead of warn=None to not start failing if this ever gets fixed
+import subprocess
+import contextlib
+debian_arch = subprocess.run(["dpkg","--print-architecture"],capture_output=True).stdout
 
 @pytest.mark.parametrize("func", [["min", "max"], ["sqrt", "max"]])
 def test_transform_wont_agg_series(string_series, func):
@@ -333,7 +339,7 @@ def test_transform_wont_agg_series(string_series, func):
     warn = RuntimeWarning if func[0] == "sqrt" else None
     warn_msg = "invalid value encountered in sqrt"
     with pytest.raises(ValueError, match=msg):
-        with tm.assert_produces_warning(warn, match=warn_msg, check_stacklevel=False):
+        with (contextlib.nullcontext() if (debian_arch==b'armel\n') else tm.assert_produces_warning(warn, match=warn_msg, check_stacklevel=False)):
             string_series.transform(func)
 
 
index 363d0285cabbc854ae6d824ffcff68dc6ef61a84..9b09d808b1a1d1f8f7907063262b3fc43c7b40d0 100644 (file)
@@ -70,6 +70,12 @@ def test_apply_np_reducer(op, how):
 @pytest.mark.parametrize("how", ["transform", "apply"])
 def test_apply_np_transformer(float_frame, op, how):
     # GH 39116
+    # armel numpy currently doesn't have the invalid log/sqrt warning (see 1.4.3-1 build log,
+    # possibly the same underlying issue as statsmodels https://bugs.debian.org/956882)
+    # using nullcontext() instead of warn=None to not start failing if this ever gets fixed
+    import subprocess
+    import contextlib
+    debian_arch = subprocess.run(["dpkg","--print-architecture"],capture_output=True).stdout
 
     # float_frame will _usually_ have negative values, which will
     #  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):
     if op in ["log", "sqrt"]:
         warn = RuntimeWarning
 
-    with tm.assert_produces_warning(warn, check_stacklevel=False):
+    with (contextlib.nullcontext() if (debian_arch==b'armel\n') else tm.assert_produces_warning(warn, check_stacklevel=False)):
         # float_frame fixture is defined in conftest.py, so we don't check the
         # stacklevel as otherwise the test would fail.
         result = getattr(float_frame, how)(op)
index b941ba4a041d34eb3d26e15f352989286531a50c..206be9ead18974f73f002650e6b2332ff7348113 100644 (file)
@@ -56,6 +56,12 @@ def test_delim_whitespace_custom_terminator(c_parser_only):
     expected = DataFrame([[1, 2, 3], [4, 5, 6], [7, 8, 9]], columns=["a", "b", "c"])
     tm.assert_frame_equal(df, expected)
 
+# armel numpy currently doesn't have some invalid warnings (see 2.0.3+dfsg-3 build log,
+# possibly the same underlying issue as statsmodels https://bugs.debian.org/956882)
+# using nullcontext() instead of warn=None to not start failing if this ever gets fixed
+import subprocess
+import contextlib
+debian_arch = subprocess.run(["dpkg","--print-architecture"],capture_output=True).stdout
 
 def test_dtype_and_names_error(c_parser_only):
     # see gh-8833: passing both dtype and names
@@ -91,7 +97,7 @@ nan 2
     # fallback casting, but not castable
     warning = RuntimeWarning if np_version_gte1p24 else None
     with pytest.raises(ValueError, match="cannot safely convert"):
-        with tm.assert_produces_warning(warning, check_stacklevel=False):
+        with (contextlib.nullcontext() if (debian_arch==b'armel\n') else tm.assert_produces_warning(warning, check_stacklevel=False)):
             parser.read_csv(
                 StringIO(data),
                 sep=r"\s+",