Skip to content

Commit 87f069a

Browse files
authored
CI: Address flaky unit tests (#51070)
* flaky test_basic_series_frame_alignment * test_raw_roundtrip is flaky * test_raw_roundtrip is flaky * Clear clipboard on CI * check=True * REduce diff
1 parent c73736c commit 87f069a

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

pandas/tests/computation/test_eval.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,19 @@ def test_basic_frame_series_alignment(
860860
def test_basic_series_frame_alignment(
861861
self, request, engine, parser, index_name, r_idx_type, c_idx_type
862862
):
863+
if (
864+
engine == "numexpr"
865+
and parser == "pandas"
866+
and index_name == "index"
867+
and r_idx_type == "i"
868+
and c_idx_type == "s"
869+
):
870+
reason = (
871+
f"Flaky column ordering when engine={engine}, "
872+
f"parser={parser}, index_name={index_name}, "
873+
f"r_idx_type={r_idx_type}, c_idx_type={c_idx_type}"
874+
)
875+
request.node.add_marker(pytest.mark.xfail(reason=reason, strict=False))
863876
df = tm.makeCustomDataframe(
864877
10, 7, data_gen_f=f, r_idx_type=r_idx_type, c_idx_type=c_idx_type
865878
)

pandas/tests/io/test_clipboard.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
import os
2+
import subprocess
23
from textwrap import dedent
34

45
import numpy as np
56
import pytest
67

7-
from pandas.compat import is_platform_mac
8+
from pandas.compat import (
9+
is_ci_environment,
10+
is_platform_linux,
11+
is_platform_mac,
12+
)
813
from pandas.errors import (
914
PyperclipException,
1015
PyperclipWindowsException,
@@ -409,6 +414,9 @@ def test_raw_roundtrip(self, data):
409414
# PR #25040 wide unicode wasn't copied correctly on PY3 on windows
410415
clipboard_set(data)
411416
assert data == clipboard_get()
417+
if is_ci_environment() and is_platform_linux():
418+
# Clipboard can sometimes keep previous param causing flaky CI failures
419+
subprocess.run(["xsel", "--delete", "--clipboard"], check=True)
412420

413421
@pytest.mark.parametrize("dtype_backend", ["pandas", "pyarrow"])
414422
@pytest.mark.parametrize("engine", ["c", "python"])

0 commit comments

Comments
 (0)