Skip to content

Commit 12b9aa4

Browse files
authored
TST: Disable testing that hangs Azure CI (#45702)
1 parent fd6f23f commit 12b9aa4

File tree

7 files changed

+47
-6
lines changed

7 files changed

+47
-6
lines changed

pandas/tests/io/excel/conftest.py

+3-1
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

+1-3
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

+3-1
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

+8
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ def sqlite_buildin_iris(sqlite_buildin, iris_path):
498498
all_connectable_iris = sqlalchemy_connectable_iris + ["sqlite_buildin_iris"]
499499

500500

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

510511

512+
@pytest.mark.db
511513
@pytest.mark.parametrize("conn", all_connectable)
512514
@pytest.mark.parametrize("mode, num_row_coef", [("replace", 1), ("append", 2)])
513515
def test_to_sql_exist(conn, mode, num_row_coef, test_frame1, request):
@@ -519,6 +521,7 @@ def test_to_sql_exist(conn, mode, num_row_coef, test_frame1, request):
519521
assert count_rows(conn, "test_frame") == num_row_coef * len(test_frame1)
520522

521523

524+
@pytest.mark.db
522525
@pytest.mark.parametrize("conn", all_connectable)
523526
def test_to_sql_exist_fail(conn, test_frame1, request):
524527
conn = request.getfixturevalue(conn)
@@ -531,6 +534,7 @@ def test_to_sql_exist_fail(conn, test_frame1, request):
531534
pandasSQL.to_sql(test_frame1, "test_frame", if_exists="fail")
532535

533536

537+
@pytest.mark.db
534538
@pytest.mark.parametrize("conn", all_connectable_iris)
535539
def test_read_iris(conn, request):
536540
conn = request.getfixturevalue(conn)
@@ -539,6 +543,7 @@ def test_read_iris(conn, request):
539543
check_iris_frame(iris_frame)
540544

541545

546+
@pytest.mark.db
542547
@pytest.mark.parametrize("conn", sqlalchemy_connectable)
543548
def test_to_sql_callable(conn, test_frame1, request):
544549
conn = request.getfixturevalue(conn)
@@ -557,6 +562,7 @@ def sample(pd_table, conn, keys, data_iter):
557562
assert count_rows(conn, "test_frame") == len(test_frame1)
558563

559564

565+
@pytest.mark.db
560566
@pytest.mark.parametrize("conn", mysql_connectable)
561567
def test_default_type_conversion(conn, request):
562568
conn = request.getfixturevalue(conn)
@@ -575,6 +581,7 @@ def test_default_type_conversion(conn, request):
575581
assert issubclass(df.BoolColWithNull.dtype.type, np.floating)
576582

577583

584+
@pytest.mark.db
578585
@pytest.mark.parametrize("conn", mysql_connectable)
579586
def test_read_procedure(conn, request):
580587
conn = request.getfixturevalue(conn)
@@ -611,6 +618,7 @@ def test_read_procedure(conn, request):
611618
tm.assert_frame_equal(df, res2)
612619

613620

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

pandas/tests/window/test_numba.py

+15
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
@pytest.fixture(params=["single", "table"])
1833
def method(request):

pandas/tests/window/test_online.py

+15
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

+2-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ def file_leak_context():
266266
ContextManager analogue to check_file_leaks.
267267
"""
268268
psutil = safe_import("psutil")
269-
if not psutil:
269+
if not psutil or is_platform_windows():
270+
# Checking for file leaks can hang on Windows CI
270271
yield
271272
else:
272273
proc = psutil.Process()

0 commit comments

Comments
 (0)