From 36012468761cc997d42dbafa012e692c6882a730 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Wed, 25 Jan 2023 12:50:03 -0800 Subject: [PATCH 1/6] flaky test_basic_series_frame_alignment --- pandas/tests/computation/test_eval.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index 18559b9b4f899..86be104b16367 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -860,6 +860,19 @@ def test_basic_frame_series_alignment( def test_basic_series_frame_alignment( self, request, engine, parser, index_name, r_idx_type, c_idx_type ): + if ( + engine == "numexpr" + and parser == "pandas" + and index_name == "index" + and r_idx_type == "i" + and c_idx_type == "s" + ): + reason = ( + f"Flaky column ordering when engine={engine}, " + f"parser={parser}, index_name={index_name}, " + f"r_idx_type={r_idx_type}, c_idx_type={c_idx_type}" + ) + request.node.add_marker(pytest.mark.xfail(reason=reason, strict=False)) df = tm.makeCustomDataframe( 10, 7, data_gen_f=f, r_idx_type=r_idx_type, c_idx_type=c_idx_type ) From 54a5922ff266e957cb335b64f8c87a613aa309be Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 27 Jan 2023 12:43:27 -0800 Subject: [PATCH 2/6] test_raw_roundtrip is flaky --- pandas/tests/io/test_clipboard.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index 5e4b2c1ebad9d..f22c90654ff02 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -4,7 +4,10 @@ import numpy as np import pytest -from pandas.compat import is_platform_mac +from pandas.compat import ( + is_ci_environment, + is_platform_mac, +) from pandas.errors import ( PyperclipException, PyperclipWindowsException, @@ -399,7 +402,16 @@ def test_round_trip_valid_encodings(self, enc, df): self.check_round_trip_frame(df, encoding=enc) @pytest.mark.single_cpu - @pytest.mark.parametrize("data", ["\U0001f44d...", "Ωœ∑´...", "abcd..."]) + @pytest.mark.parametrize( + "data", + [ + "\U0001f44d...", + pytest.param( + "Ωœ∑´...", marks=pytest.mark.xfail(is_ci_environment(), strict=False) + ), + "abcd...", + ], + ) @pytest.mark.xfail( os.environ.get("DISPLAY") is None and not is_platform_mac(), reason="Cannot be runed if a headless system is not put in place with Xvfb", From 6589765d166980a032ab71f0384703284f627e8c Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 27 Jan 2023 12:44:07 -0800 Subject: [PATCH 3/6] test_raw_roundtrip is flaky --- pandas/tests/io/test_clipboard.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index f22c90654ff02..fd7db0e396019 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -407,7 +407,10 @@ def test_round_trip_valid_encodings(self, enc, df): [ "\U0001f44d...", pytest.param( - "Ωœ∑´...", marks=pytest.mark.xfail(is_ci_environment(), strict=False) + "Ωœ∑´...", + marks=pytest.mark.xfail( + is_ci_environment(), reason="Flaky on CI builds", strict=False + ), ), "abcd...", ], From 2dbd43c59acfa0731fee359da02f561796551e28 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 30 Jan 2023 10:46:58 -0800 Subject: [PATCH 4/6] Clear clipboard on CI --- pandas/tests/io/test_clipboard.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index fd7db0e396019..e4e58bd816ce7 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -1,4 +1,5 @@ import os +import subprocess from textwrap import dedent import numpy as np @@ -6,6 +7,7 @@ from pandas.compat import ( is_ci_environment, + is_platform_linux, is_platform_mac, ) from pandas.errors import ( @@ -406,12 +408,7 @@ def test_round_trip_valid_encodings(self, enc, df): "data", [ "\U0001f44d...", - pytest.param( - "Ωœ∑´...", - marks=pytest.mark.xfail( - is_ci_environment(), reason="Flaky on CI builds", strict=False - ), - ), + "Ωœ∑´...", "abcd...", ], ) @@ -424,6 +421,9 @@ def test_raw_roundtrip(self, data): # PR #25040 wide unicode wasn't copied correctly on PY3 on windows clipboard_set(data) assert data == clipboard_get() + if is_ci_environment() and is_platform_linux(): + # Clipboard can sometimes keep previous param causing flaky CI failures + subprocess.run(["xsel", "--delete", "--clipboard"]) @pytest.mark.parametrize("dtype_backend", ["pandas", "pyarrow"]) @pytest.mark.parametrize("engine", ["c", "python"]) From fd02673c2c04b8026fb652721eee07de8c110087 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 30 Jan 2023 17:39:15 -0800 Subject: [PATCH 5/6] check=True --- pandas/tests/io/test_clipboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index e4e58bd816ce7..898f5815aa1dd 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -423,7 +423,7 @@ def test_raw_roundtrip(self, data): assert data == clipboard_get() if is_ci_environment() and is_platform_linux(): # Clipboard can sometimes keep previous param causing flaky CI failures - subprocess.run(["xsel", "--delete", "--clipboard"]) + subprocess.run(["xsel", "--delete", "--clipboard"], check=True) @pytest.mark.parametrize("dtype_backend", ["pandas", "pyarrow"]) @pytest.mark.parametrize("engine", ["c", "python"]) From ea6c8285050d4dff94f0c061147c8a08458870a4 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 30 Jan 2023 17:40:23 -0800 Subject: [PATCH 6/6] REduce diff --- pandas/tests/io/test_clipboard.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pandas/tests/io/test_clipboard.py b/pandas/tests/io/test_clipboard.py index 898f5815aa1dd..d018affdecfca 100644 --- a/pandas/tests/io/test_clipboard.py +++ b/pandas/tests/io/test_clipboard.py @@ -404,14 +404,7 @@ def test_round_trip_valid_encodings(self, enc, df): self.check_round_trip_frame(df, encoding=enc) @pytest.mark.single_cpu - @pytest.mark.parametrize( - "data", - [ - "\U0001f44d...", - "Ωœ∑´...", - "abcd...", - ], - ) + @pytest.mark.parametrize("data", ["\U0001f44d...", "Ωœ∑´...", "abcd..."]) @pytest.mark.xfail( os.environ.get("DISPLAY") is None and not is_platform_mac(), reason="Cannot be runed if a headless system is not put in place with Xvfb",