Skip to content

CLN: move pytest config to pyproject.toml #40656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7eeab68
CLN: move pytest config to pyproject.toml
fangchenli Mar 27, 2021
1d81b7d
fix typo
fangchenli Mar 27, 2021
226a009
fix space
fangchenli Mar 27, 2021
a9679a4
fix space
fangchenli Mar 27, 2021
310e57a
move more opts to config file
fangchenli Mar 27, 2021
af3be8d
move more opts to config file
fangchenli Mar 27, 2021
96e8d20
change min version
fangchenli Mar 27, 2021
39f61e5
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Mar 30, 2021
9d0e37c
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Mar 31, 2021
e39a0ce
add comment back
fangchenli Mar 31, 2021
e7df3da
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 1, 2021
dbb9306
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 3, 2021
1c348f9
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 8, 2021
f2544d6
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 9, 2021
929f321
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 11, 2021
691a4d1
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 12, 2021
9e18cc5
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 13, 2021
5364094
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 16, 2021
abf920c
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 18, 2021
cc71613
Merge branch 'master' into pytest-config
fangchenli Apr 19, 2021
db34d63
resolve conflict
fangchenli Apr 19, 2021
e7a2bb6
Merge branch 'pytest-config' of https://github.com/fangchenli/pandas …
fangchenli Apr 19, 2021
238902f
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 21, 2021
8735fa4
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 21, 2021
9b51cda
unpin pytest version
fangchenli Apr 21, 2021
262e7ec
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 21, 2021
aac496f
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 21, 2021
e08d045
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 22, 2021
b0bca7c
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 22, 2021
6683409
Merge branch 'master' into pytest-config
fangchenli Apr 23, 2021
80ba633
resolve conflict
fangchenli Apr 23, 2021
4179174
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 23, 2021
840e6a4
Merge remote-tracking branch 'upstream/master' into pytest-config
fangchenli Apr 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
if: always()

- name: Testing docstring validation script
run: pytest --capture=no --strict-markers scripts
run: pytest scripts
if: always()

- name: Running benchmarks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
uses: ./.github/actions/build_pandas

- name: Test
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
run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile --cov=pandas --cov-report=xml pandas/tests/io
if: always()

- name: Build Version
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-37-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:

# tools
- cython=0.29.21
- pytest=5.0.1
- pytest>=6.0
- pytest-cov
- pytest-xdist>=1.21
- hypothesis>=3.58.0
Expand Down
4 changes: 2 additions & 2 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then
XVFB="xvfb-run "
fi

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

if [[ $(uname) != "Linux" && $(uname) != "Darwin" ]]; then
# GH#37455 windows py38 build appears to be running out of memory
Expand All @@ -30,7 +30,7 @@ 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"
PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas"

echo $PYTEST_AM_CMD
sh -c "$PYTEST_AM_CMD"
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pandas is equipped with an exhaustive set of unit tests, covering about 97% of
the code base as of this writing. To run it on your machine to verify that
everything is working (and that you have all of the dependencies, soft and hard,
installed), make sure you have `pytest
<https://docs.pytest.org/en/latest/>`__ >= 5.0.1 and `Hypothesis
<https://docs.pytest.org/en/latest/>`__ >= 6.0 and `Hypothesis
<https://hypothesis.readthedocs.io/>`__ >= 3.58, then run:

::
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.3.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ If installed, we now require:
+-----------------+-----------------+----------+---------+
| numexpr | 2.6.8 | | |
+-----------------+-----------------+----------+---------+
| pytest (dev) | 5.0.1 | | |
| pytest (dev) | 6.0 | | X |
+-----------------+-----------------+----------+---------+
| mypy (dev) | 0.800 | | X |
+-----------------+-----------------+----------+---------+
Expand Down
18 changes: 0 additions & 18 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,28 +66,10 @@
MultiIndex,
)


# ----------------------------------------------------------------
# Configuration / Settings
# ----------------------------------------------------------------
# pytest
def pytest_configure(config):
# Register marks to avoid warnings in pandas.test()
# sync with setup.cfg
config.addinivalue_line("markers", "single: mark a test as single cpu only")
config.addinivalue_line("markers", "slow: mark a test as slow")
config.addinivalue_line("markers", "network: mark a test as network")
config.addinivalue_line(
"markers", "db: tests requiring a database (mysql or postgres)"
)
config.addinivalue_line("markers", "high_memory: mark a test as a high-memory only")
config.addinivalue_line("markers", "clipboard: mark a pd.read_clipboard test")
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):
Expand Down
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,30 @@ exclude = '''
| setup.py
)
'''

[tool.pytest.ini_options]
# sync minversion with pyproject.toml & install.rst
minversion = "6.0"
addopts = "--strict-data-files --strict-markers --capture=no --durations=30 --junitxml=test-data.xml"
xfail_strict = true
testpaths = "pandas"
doctest_optionflags = [
"NORMALIZE_WHITESPACE",
"IGNORE_EXCEPTION_DETAIL",
"ELLIPSIS",
]
filterwarnings = [
"error:Sparse:FutureWarning",
"error:The SparseArray:FutureWarning",
]
junit_family = "xunit2"
markers = [
"single: mark a test as single cpu only",
"slow: mark a test as slow",
"network: mark a test as network",
"db: tests requiring a database (mysql or postgres)",
"high_memory: mark a test as a high-memory only",
"clipboard: mark a pd.read_clipboard test",
"arm_slow: mark a test as slow for arm64 architecture",
"arraymanager: mark a test to run with ArrayManager enabled",
]
14 changes: 1 addition & 13 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pandas_plotting_backends =
[options.extras_require]
test =
hypothesis>=3.58
pytest>=5.0.1
pytest>=6.0
pytest-xdist

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

[tool:pytest]
# sync minversion with setup.cfg & install.rst
minversion = 5.0.1
testpaths = pandas
doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS
addopts = --strict-data-files
xfail_strict = True
filterwarnings =
error:Sparse:FutureWarning
error:The SparseArray:FutureWarning
junit_family = xunit2

[codespell]
ignore-words-list = ba,blocs,coo,hist,nd,sav,ser
ignore-regex = https://(\w+\.)+
Expand Down
2 changes: 1 addition & 1 deletion test_fast.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
:: test on windows
set PYTHONHASHSEED=314159265
pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX --strict-markers pandas
pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX pandas
2 changes: 1 addition & 1 deletion test_fast.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# https://github.com/pytest-dev/pytest/issues/1075
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')

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