Skip to content

Commit 1f288fa

Browse files
authored
CI/TST: Address some warnings (#54222)
* CI/TST: Address some warnings * More warning filters
1 parent f218fa3 commit 1f288fa

File tree

8 files changed

+40
-6
lines changed

8 files changed

+40
-6
lines changed

.github/workflows/unit-tests.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103

104104
services:
105105
mysql:
106-
image: mysql
106+
image: mysql:8.0.33
107107
env:
108108
MYSQL_ALLOW_EMPTY_PASSWORD: yes
109109
MYSQL_DATABASE: pandas
@@ -116,8 +116,9 @@ jobs:
116116
- 3306:3306
117117

118118
postgres:
119-
image: postgres
119+
image: postgres:13
120120
env:
121+
PGUSER: postgres
121122
POSTGRES_USER: postgres
122123
POSTGRES_PASSWORD: postgres
123124
POSTGRES_DB: pandas
@@ -130,7 +131,7 @@ jobs:
130131
- 5432:5432
131132

132133
moto:
133-
image: motoserver/moto:4.1.12
134+
image: motoserver/moto:4.1.13
134135
env:
135136
AWS_ACCESS_KEY_ID: foobar_key
136137
AWS_SECRET_ACCESS_KEY: foobar_secret
@@ -237,7 +238,7 @@ jobs:
237238
run: |
238239
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
239240
. ~/virtualenvs/pandas-dev/bin/activate
240-
python -m pip install -U pip wheel setuptools meson[ninja]==1.0.1 meson-python==0.13.1
241+
python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.0.1 meson-python==0.13.1
241242
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
242243
python -m pip install --no-cache-dir --no-build-isolation -e .
243244
python -m pip list --no-cache-dir
@@ -275,7 +276,7 @@ jobs:
275276
run: |
276277
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
277278
. ~/virtualenvs/pandas-dev/bin/activate
278-
python -m pip install -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.0.1
279+
python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.0.1
279280
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
280281
python -m pip install --no-cache-dir --no-build-isolation -e .
281282
python -m pip list --no-cache-dir

ci/meta.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ requirements:
3434
- tomli # [py<311]
3535
run:
3636
- python
37-
- {{ pin_compatible('numpy') }}
37+
- numpy >=1.21.6 # [py<311]
38+
- numpy >=1.23.2 # [py>=311]
3839
- python-dateutil >=2.8.2
3940
- pytz >=2020.1
4041
- python-tzdata >=2022.1

pandas/tests/arrays/sparse/test_unary.py

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pandas.core.arrays import SparseArray
99

1010

11+
@pytest.mark.filterwarnings("ignore:invalid value encountered in cast:RuntimeWarning")
1112
@pytest.mark.parametrize("fill_value", [0, np.nan])
1213
@pytest.mark.parametrize("op", [operator.pos, operator.neg])
1314
def test_unary_op(op, fill_value):
@@ -36,6 +37,9 @@ def test_invert(fill_value):
3637

3738

3839
class TestUnaryMethods:
40+
@pytest.mark.filterwarnings(
41+
"ignore:invalid value encountered in cast:RuntimeWarning"
42+
)
3943
def test_neg_operator(self):
4044
arr = SparseArray([-1, -2, np.nan, 3], fill_value=np.nan, dtype=np.int8)
4145
res = -arr
@@ -47,6 +51,9 @@ def test_neg_operator(self):
4751
exp = SparseArray([1, 2, -1, -3], fill_value=1, dtype=np.int8)
4852
tm.assert_sp_array_equal(exp, res)
4953

54+
@pytest.mark.filterwarnings(
55+
"ignore:invalid value encountered in cast:RuntimeWarning"
56+
)
5057
def test_abs_operator(self):
5158
arr = SparseArray([-1, -2, np.nan, 3], fill_value=np.nan, dtype=np.int8)
5259
res = abs(arr)

pandas/tests/extension/test_boolean.py

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
from pandas.core.arrays.boolean import BooleanDtype
2727
from pandas.tests.extension import base
2828

29+
pytestmark = [
30+
pytest.mark.filterwarnings(
31+
"ignore:invalid value encountered in divide:RuntimeWarning"
32+
),
33+
pytest.mark.filterwarnings("ignore:Mean of empty slice:RuntimeWarning"),
34+
]
35+
2936

3037
def make_data():
3138
return [True, False] * 4 + [np.nan] + [True, False] * 44 + [np.nan] + [True, False]

pandas/tests/extension/test_floating.py

+8
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
masked_shared,
3131
)
3232

33+
pytestmark = [
34+
pytest.mark.filterwarnings("ignore:overflow encountered in reduce:RuntimeWarning"),
35+
pytest.mark.filterwarnings(
36+
"ignore:invalid value encountered in divide:RuntimeWarning"
37+
),
38+
pytest.mark.filterwarnings("ignore:Mean of empty slice:RuntimeWarning"),
39+
]
40+
3341

3442
def make_data():
3543
return (

pandas/tests/extension/test_integer.py

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@
3737
masked_shared,
3838
)
3939

40+
pytestmark = [
41+
pytest.mark.filterwarnings(
42+
"ignore:invalid value encountered in divide:RuntimeWarning"
43+
),
44+
pytest.mark.filterwarnings("ignore:Mean of empty slice:RuntimeWarning"),
45+
]
46+
4047

4148
def make_data():
4249
return list(range(1, 9)) + [pd.NA] + list(range(10, 98)) + [pd.NA] + [99, 100]

pandas/tests/groupby/test_groupby.py

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
import pandas.core.common as com
3131
from pandas.tests.groupby import get_groupby_method_args
3232

33+
pytestmark = pytest.mark.filterwarnings("ignore:Mean of empty slice:RuntimeWarning")
34+
3335

3436
def test_repr():
3537
# GH18203

pandas/tests/series/methods/test_describe.py

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ def test_datetime_is_numeric_includes_datetime(self):
158158
)
159159
tm.assert_series_equal(result, expected)
160160

161+
@pytest.mark.filterwarnings("ignore:Casting complex values to real discards")
161162
def test_numeric_result_dtype(self, any_numeric_dtype):
162163
# GH#48340 - describe should always return float on non-complex numeric input
163164
if is_extension_array_dtype(any_numeric_dtype):

0 commit comments

Comments
 (0)