Skip to content

Commit c9807e1

Browse files
fangchenliJulianWgs
authored andcommitted
CLN: move pytest config to pyproject.toml (pandas-dev#40656)
* CLN: move pytest config to pyproject.toml * fix typo * fix space * fix space * move more opts to config file * move more opts to config file * change min version * add comment back * resolve conflict * unpin pytest version * resolve conflict
1 parent cee6475 commit c9807e1

File tree

11 files changed

+37
-40
lines changed

11 files changed

+37
-40
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
if: always()
6666

6767
- name: Testing docstring validation script
68-
run: pytest --capture=no --strict-markers scripts
68+
run: pytest scripts
6969
if: always()
7070

7171
- name: Running benchmarks

.github/workflows/database.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
uses: ./.github/actions/build_pandas
7979

8080
- name: Test
81-
run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile -s --strict-markers --durations=30 --junitxml=test-data.xml -s --cov=pandas --cov-report=xml pandas/tests/io
81+
run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile --cov=pandas --cov-report=xml pandas/tests/io
8282
if: always()
8383

8484
- name: Build Version

ci/deps/actions-37-minimum_versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66

77
# tools
88
- cython=0.29.21
9-
- pytest=5.0.1
9+
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0

ci/run_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then
1919
XVFB="xvfb-run "
2020
fi
2121

22-
PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile -s --strict-markers --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas"
22+
PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas"
2323

2424
if [[ $(uname) != "Linux" && $(uname) != "Darwin" ]]; then
2525
# GH#37455 windows py38 build appears to be running out of memory
@@ -30,7 +30,7 @@ fi
3030
echo $PYTEST_CMD
3131
sh -c "$PYTEST_CMD"
3232

33-
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"
33+
PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas"
3434

3535
echo $PYTEST_AM_CMD
3636
sh -c "$PYTEST_AM_CMD"

doc/source/getting_started/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ pandas is equipped with an exhaustive set of unit tests, covering about 97% of
195195
the code base as of this writing. To run it on your machine to verify that
196196
everything is working (and that you have all of the dependencies, soft and hard,
197197
installed), make sure you have `pytest
198-
<https://docs.pytest.org/en/latest/>`__ >= 5.0.1 and `Hypothesis
198+
<https://docs.pytest.org/en/latest/>`__ >= 6.0 and `Hypothesis
199199
<https://hypothesis.readthedocs.io/>`__ >= 3.58, then run:
200200

201201
::

doc/source/whatsnew/v1.3.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ If installed, we now require:
515515
+-----------------+-----------------+----------+---------+
516516
| numexpr | 2.6.8 | | |
517517
+-----------------+-----------------+----------+---------+
518-
| pytest (dev) | 5.0.1 | | |
518+
| pytest (dev) | 6.0 | | X |
519519
+-----------------+-----------------+----------+---------+
520520
| mypy (dev) | 0.800 | | X |
521521
+-----------------+-----------------+----------+---------+

pandas/conftest.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,28 +66,10 @@
6666
MultiIndex,
6767
)
6868

69-
7069
# ----------------------------------------------------------------
7170
# Configuration / Settings
7271
# ----------------------------------------------------------------
7372
# pytest
74-
def pytest_configure(config):
75-
# Register marks to avoid warnings in pandas.test()
76-
# sync with setup.cfg
77-
config.addinivalue_line("markers", "single: mark a test as single cpu only")
78-
config.addinivalue_line("markers", "slow: mark a test as slow")
79-
config.addinivalue_line("markers", "network: mark a test as network")
80-
config.addinivalue_line(
81-
"markers", "db: tests requiring a database (mysql or postgres)"
82-
)
83-
config.addinivalue_line("markers", "high_memory: mark a test as a high-memory only")
84-
config.addinivalue_line("markers", "clipboard: mark a pd.read_clipboard test")
85-
config.addinivalue_line(
86-
"markers", "arm_slow: mark a test as slow for arm64 architecture"
87-
)
88-
config.addinivalue_line(
89-
"markers", "arraymanager: mark a test to run with ArrayManager enabled"
90-
)
9173

9274

9375
def pytest_addoption(parser):

pyproject.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,30 @@ exclude = '''
3232
| setup.py
3333
)
3434
'''
35+
36+
[tool.pytest.ini_options]
37+
# sync minversion with pyproject.toml & install.rst
38+
minversion = "6.0"
39+
addopts = "--strict-data-files --strict-markers --capture=no --durations=30 --junitxml=test-data.xml"
40+
xfail_strict = true
41+
testpaths = "pandas"
42+
doctest_optionflags = [
43+
"NORMALIZE_WHITESPACE",
44+
"IGNORE_EXCEPTION_DETAIL",
45+
"ELLIPSIS",
46+
]
47+
filterwarnings = [
48+
"error:Sparse:FutureWarning",
49+
"error:The SparseArray:FutureWarning",
50+
]
51+
junit_family = "xunit2"
52+
markers = [
53+
"single: mark a test as single cpu only",
54+
"slow: mark a test as slow",
55+
"network: mark a test as network",
56+
"db: tests requiring a database (mysql or postgres)",
57+
"high_memory: mark a test as a high-memory only",
58+
"clipboard: mark a pd.read_clipboard test",
59+
"arm_slow: mark a test as slow for arm64 architecture",
60+
"arraymanager: mark a test to run with ArrayManager enabled",
61+
]

setup.cfg

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pandas_plotting_backends =
4545
[options.extras_require]
4646
test =
4747
hypothesis>=3.58
48-
pytest>=5.0.1
48+
pytest>=6.0
4949
pytest-xdist
5050

5151
[options.package_data]
@@ -127,18 +127,6 @@ exclude =
127127
# https://github.com/pandas-dev/pandas/pull/38837#issuecomment-752884156
128128
doc/source/getting_started/comparison/includes/*.rst
129129

130-
[tool:pytest]
131-
# sync minversion with setup.cfg & install.rst
132-
minversion = 5.0.1
133-
testpaths = pandas
134-
doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS
135-
addopts = --strict-data-files
136-
xfail_strict = True
137-
filterwarnings =
138-
error:Sparse:FutureWarning
139-
error:The SparseArray:FutureWarning
140-
junit_family = xunit2
141-
142130
[codespell]
143131
ignore-words-list = ba,blocs,coo,hist,nd,sav,ser
144132
ignore-regex = https://(\w+\.)+

test_fast.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
:: test on windows
22
set PYTHONHASHSEED=314159265
3-
pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX --strict-markers pandas
3+
pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX pandas

test_fast.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
# https://github.com/pytest-dev/pytest/issues/1075
66
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
77

8-
pytest pandas --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sxX --strict-markers "$@"
8+
pytest pandas --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sxX "$@"

0 commit comments

Comments
 (0)