From acacff35b1fe87875e2fddccbbadbc1c6834d156 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Thu, 25 Mar 2021 09:28:21 +0100 Subject: [PATCH] [ArrayManager] TST: include subset of ArrayManager tests in all CI builds (#40496) --- ci/run_tests.sh | 5 +++++ pandas/conftest.py | 10 ++++++++++ pandas/tests/frame/indexing/test_setitem.py | 4 +++- pandas/tests/frame/test_reductions.py | 3 ++- pandas/tests/frame/test_stack_unstack.py | 2 +- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ci/run_tests.sh b/ci/run_tests.sh index ec4c87e8c91b0..d73940c1010ad 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -29,3 +29,8 @@ fi echo $PYTEST_CMD sh -c "$PYTEST_CMD" + +PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile -s --strict-markers --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas" + +echo $PYTEST_AM_CMD +sh -c "$PYTEST_AM_CMD" diff --git a/pandas/conftest.py b/pandas/conftest.py index 688ad6dcc5e48..f3356d2998ff8 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -85,6 +85,9 @@ def pytest_configure(config): config.addinivalue_line( "markers", "arm_slow: mark a test as slow for arm64 architecture" ) + config.addinivalue_line( + "markers", "arraymanager: mark a test to run with ArrayManager enabled" + ) def pytest_addoption(parser): @@ -121,6 +124,13 @@ def pytest_runtest_setup(item): pytest.skip("skipping high memory test since --run-high-memory was not set") +def pytest_collection_modifyitems(items): + for item in items: + # mark all tests in the pandas/tests/frame directory with "arraymanager" + if "/frame/" in item.nodeid: + item.add_marker(pytest.mark.arraymanager) + + # Hypothesis hypothesis.settings.register_profile( "ci", diff --git a/pandas/tests/frame/indexing/test_setitem.py b/pandas/tests/frame/indexing/test_setitem.py index 199347383b171..1d41426b93db6 100644 --- a/pandas/tests/frame/indexing/test_setitem.py +++ b/pandas/tests/frame/indexing/test_setitem.py @@ -926,7 +926,9 @@ def test_setitem_duplicate_columns_not_inplace(self): tm.assert_frame_equal(df_view, df_copy) tm.assert_frame_equal(df, expected) - @pytest.mark.parametrize("value", [1, np.array([[1], [1]]), [[1], [1]]]) + @pytest.mark.parametrize( + "value", [1, np.array([[1], [1]], dtype="int64"), [[1], [1]]] + ) def test_setitem_same_dtype_not_inplace(self, value, using_array_manager, request): # GH#39510 if not using_array_manager: diff --git a/pandas/tests/frame/test_reductions.py b/pandas/tests/frame/test_reductions.py index 672ab20fb9791..b294c97409951 100644 --- a/pandas/tests/frame/test_reductions.py +++ b/pandas/tests/frame/test_reductions.py @@ -382,7 +382,8 @@ def kurt(x): pass # TODO: Ensure warning isn't emitted in the first place - @pytest.mark.filterwarnings("ignore:All-NaN:RuntimeWarning") + # ignore mean of empty slice and all-NaN + @pytest.mark.filterwarnings("ignore::RuntimeWarning") def test_median(self, float_frame_with_na, int_frame): def wrapper(x): if isna(x).any(): diff --git a/pandas/tests/frame/test_stack_unstack.py b/pandas/tests/frame/test_stack_unstack.py index 253f416bd6f18..cc4042822bc8b 100644 --- a/pandas/tests/frame/test_stack_unstack.py +++ b/pandas/tests/frame/test_stack_unstack.py @@ -905,7 +905,7 @@ def test_unstack_nan_index3(self, using_array_manager): if using_array_manager: # INFO(ArrayManager) with ArrayManager preserve dtype where possible cols = right.columns[[1, 2, 3, 5]] - right[cols] = right[cols].astype("int64") + right[cols] = right[cols].astype(df["C"].dtype) tm.assert_frame_equal(left, right) def test_unstack_nan_index4(self):