From 0d5fcb82a93a7c18e2238e440a2208d9d699dbf2 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Mon, 24 Nov 2025 23:20:00 +0000 Subject: [PATCH] Move pytest configuration settings to ``.pytest.toml`` (#14082) --- .github/workflows/main.yml | 2 ++ .pytest.toml | 31 +++++++++++++++++++++++++++++++ pyproject.toml | 27 +-------------------------- 3 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 .pytest.toml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26fa5fb5ab..f60c70ebb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,11 +4,13 @@ on: push: paths: - ".github/workflows/main.yml" + - ".pytest.toml" - "sphinx/**" - "tests/**" pull_request: paths: - ".github/workflows/main.yml" + - ".pytest.toml" - "sphinx/**" - "tests/**" diff --git a/.pytest.toml b/.pytest.toml new file mode 100644 index 0000000000..3d4c979802 --- /dev/null +++ b/.pytest.toml @@ -0,0 +1,31 @@ +# https://docs.pytest.org/en/stable/reference/reference.html#configuration-options + +[pytest] +minversion = "9.0" + +# https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags +addopts = [ + "-ra", + "--import-mode=prepend", +# "--pythonwarnings=error", +] + +empty_parameter_set_mark = "xfail" +filterwarnings = [ + "all", + "ignore::DeprecationWarning:docutils.io", + "ignore:Distutils was imported before Setuptools:UserWarning:_distutils_hack", + "ignore:Setuptools is replacing distutils:UserWarning:_distutils_hack", + "ignore::DeprecationWarning:pyximport.pyximport", + "ignore::ImportWarning:importlib._bootstrap", +] +log_cli_level = "INFO" +markers = [ + "apidoc", +] +testpaths = ["tests"] + +strict_config = true +strict_markers = true +#strict_parametrization_ids = true +strict_xfail = true diff --git a/pyproject.toml b/pyproject.toml index 0086edce0f..c282c415cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,7 +118,7 @@ package = [ "twine>=6.1", ] test = [ - "pytest>=8.0", + "pytest>=9.0", "pytest-xdist[psutil]>=3.4", "cython>=3.0", # for Cython compilation "defusedxml>=0.7.1", # for secure XML/HTML parsing @@ -304,31 +304,6 @@ disallow_untyped_defs = false module = ["tests.test_util.typing_test_data"] ignore_errors = true -[tool.pytest.ini_options] -minversion = "6.0" -addopts = [ - "-ra", - "--import-mode=prepend", -# "--pythonwarnings=error", - "--strict-config", - "--strict-markers", -] -empty_parameter_set_mark = "xfail" -filterwarnings = [ - "all", - "ignore::DeprecationWarning:docutils.io", - "ignore:Distutils was imported before Setuptools:UserWarning:_distutils_hack", - "ignore:Setuptools is replacing distutils:UserWarning:_distutils_hack", - "ignore::DeprecationWarning:pyximport.pyximport", - "ignore::ImportWarning:importlib._bootstrap", -] -log_cli_level = "INFO" -markers = [ - "apidoc", -] -testpaths = ["tests"] -xfail_strict = true - [tool.coverage.run] branch = true parallel = true