Skip to content

Commit ed7c980

Browse files
Backport PR pandas-dev#45702: TST: Disable testing that hangs Azure CI (pandas-dev#45718)
Co-authored-by: Matthew Roeschke <[email protected]>
1 parent 1f64469 commit ed7c980

File tree

7 files changed

+47
-6
lines changed

7 files changed

+47
-6
lines changed

pandas/tests/io/excel/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22

3+
from pandas.compat import is_platform_windows
34
import pandas.util._test_decorators as td
45

56
import pandas._testing as tm
@@ -43,7 +44,8 @@ def read_ext(request):
4344
return request.param
4445

4546

46-
@pytest.fixture(autouse=True)
47+
# Checking for file leaks can hang on Windows CI
48+
@pytest.fixture(autouse=not is_platform_windows())
4749
def check_for_file_leaks():
4850
"""
4951
Fixture to run around every test to ensure that we are not leaking files.

pandas/tests/io/excel/test_readers.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ def parser(self, *args, **kwargs):
150150
expected = expected_defaults[read_ext[1:]]
151151
assert result == expected
152152

153-
def test_usecols_int(self, read_ext, df_ref):
154-
df_ref = df_ref.reindex(columns=["A", "B", "C"])
155-
153+
def test_usecols_int(self, read_ext):
156154
# usecols as int
157155
msg = "Passing an integer for `usecols`"
158156
with pytest.raises(ValueError, match=msg):

pandas/tests/io/parser/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ def all_parsers(request):
108108
parser = request.param()
109109
if parser.engine == "pyarrow":
110110
pytest.importorskip("pyarrow", VERSIONS["pyarrow"])
111-
# Try setting num cpus to 1 to avoid hangs?
111+
# Try setting num cpus to 1 to avoid hangs on Azure MacOS/Windows builds
112+
# or better yet find a way to disable threads
113+
# TODO(GH#44584) pytest.mark.single these tests
112114
import pyarrow
113115

114116
pyarrow.set_cpu_count(1)

pandas/tests/io/test_sql.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ def sqlite_buildin_iris(sqlite_buildin, iris_path):
499499
all_connectable_iris = sqlalchemy_connectable_iris + ["sqlite_buildin_iris"]
500500

501501

502+
@pytest.mark.db
502503
@pytest.mark.parametrize("conn", all_connectable)
503504
@pytest.mark.parametrize("method", [None, "multi"])
504505
def test_to_sql(conn, method, test_frame1, request):
@@ -509,6 +510,7 @@ def test_to_sql(conn, method, test_frame1, request):
509510
assert count_rows(conn, "test_frame") == len(test_frame1)
510511

511512

513+
@pytest.mark.db
512514
@pytest.mark.parametrize("conn", all_connectable)
513515
@pytest.mark.parametrize("mode, num_row_coef", [("replace", 1), ("append", 2)])
514516
def test_to_sql_exist(conn, mode, num_row_coef, test_frame1, request):
@@ -520,6 +522,7 @@ def test_to_sql_exist(conn, mode, num_row_coef, test_frame1, request):
520522
assert count_rows(conn, "test_frame") == num_row_coef * len(test_frame1)
521523

522524

525+
@pytest.mark.db
523526
@pytest.mark.parametrize("conn", all_connectable)
524527
def test_to_sql_exist_fail(conn, test_frame1, request):
525528
conn = request.getfixturevalue(conn)
@@ -532,6 +535,7 @@ def test_to_sql_exist_fail(conn, test_frame1, request):
532535
pandasSQL.to_sql(test_frame1, "test_frame", if_exists="fail")
533536

534537

538+
@pytest.mark.db
535539
@pytest.mark.parametrize("conn", all_connectable_iris)
536540
def test_read_iris(conn, request):
537541
conn = request.getfixturevalue(conn)
@@ -540,6 +544,7 @@ def test_read_iris(conn, request):
540544
check_iris_frame(iris_frame)
541545

542546

547+
@pytest.mark.db
543548
@pytest.mark.parametrize("conn", sqlalchemy_connectable)
544549
def test_to_sql_callable(conn, test_frame1, request):
545550
conn = request.getfixturevalue(conn)
@@ -558,6 +563,7 @@ def sample(pd_table, conn, keys, data_iter):
558563
assert count_rows(conn, "test_frame") == len(test_frame1)
559564

560565

566+
@pytest.mark.db
561567
@pytest.mark.parametrize("conn", mysql_connectable)
562568
def test_default_type_conversion(conn, request):
563569
conn = request.getfixturevalue(conn)
@@ -576,6 +582,7 @@ def test_default_type_conversion(conn, request):
576582
assert issubclass(df.BoolColWithNull.dtype.type, np.floating)
577583

578584

585+
@pytest.mark.db
579586
@pytest.mark.parametrize("conn", mysql_connectable)
580587
def test_read_procedure(conn, request):
581588
conn = request.getfixturevalue(conn)
@@ -612,6 +619,7 @@ def test_read_procedure(conn, request):
612619
tm.assert_frame_equal(df, res2)
613620

614621

622+
@pytest.mark.db
615623
@pytest.mark.parametrize("conn", postgresql_connectable)
616624
def test_copy_from_callable_insertion_method(conn, request):
617625
# GH 8953

pandas/tests/window/test_numba.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import os
2+
13
import numpy as np
24
import pytest
35

6+
from pandas.compat import (
7+
is_platform_mac,
8+
is_platform_windows,
9+
)
410
from pandas.errors import NumbaUtilError
511
import pandas.util._test_decorators as td
612

@@ -13,6 +19,15 @@
1319
import pandas._testing as tm
1420
from pandas.core.util.numba_ import NUMBA_FUNC_CACHE
1521

22+
# TODO(GH#44584): Mark these as pytest.mark.single
23+
pytestmark = pytest.mark.skipif(
24+
os.environ.get("PANDAS_CI", "0") == "1"
25+
and (is_platform_windows() or is_platform_mac()),
26+
reason="On Azure CI, Windows can fail with "
27+
"'Windows fatal exception: stack overflow' "
28+
"and MacOS can timeout",
29+
)
30+
1631

1732
@td.skip_if_no("numba")
1833
@pytest.mark.filterwarnings("ignore:\n")

pandas/tests/window/test_online.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
import os
2+
13
import numpy as np
24
import pytest
35

6+
from pandas.compat import (
7+
is_platform_mac,
8+
is_platform_windows,
9+
)
410
import pandas.util._test_decorators as td
511

612
from pandas import (
@@ -9,6 +15,15 @@
915
)
1016
import pandas._testing as tm
1117

18+
# TODO(GH#44584): Mark these as pytest.mark.single
19+
pytestmark = pytest.mark.skipif(
20+
os.environ.get("PANDAS_CI", "0") == "1"
21+
and (is_platform_windows() or is_platform_mac()),
22+
reason="On Azure CI, Windows can fail with "
23+
"'Windows fatal exception: stack overflow' "
24+
"and MacOS can timeout",
25+
)
26+
1227

1328
@td.skip_if_no("numba")
1429
@pytest.mark.filterwarnings("ignore:\n")

pandas/util/_test_decorators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,8 @@ def file_leak_context():
260260
ContextManager analogue to check_file_leaks.
261261
"""
262262
psutil = safe_import("psutil")
263-
if not psutil:
263+
if not psutil or is_platform_windows():
264+
# Checking for file leaks can hang on Windows CI
264265
yield
265266
else:
266267
proc = psutil.Process()

0 commit comments

Comments
 (0)