feat: migrate pytest configuration to pyproject.toml

Migrates pytest configuration from setup.cfg, preserving all settings
and comments including warning filters and test discovery patterns.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Feanil Patel
2026-01-20 11:50:29 -05:00
parent af55bcfe22
commit bbc12f1b02
2 changed files with 25 additions and 26 deletions

View File

@@ -179,3 +179,28 @@ team = "openedx.core.lib.teams_config:create_team_set_partition"
[project.entry-points.console_scripts]
xmodule_assets = "xmodule.static_content:main"
[tool.pytest.ini_options]
# Note: The first file of settings found is used, there is no combining, so
# this file is only used for tests that don't find a pytest.ini file first.
# Details at https://docs.pytest.org/en/latest/reference/customize.html
DJANGO_SETTINGS_MODULE = "lms.envs.test"
addopts = "--nomigrations --reuse-db --durations=20 --json-report --json-report-omit keywords streams collectors log traceback tests --json-report-file=none"
# Enable default handling for all warnings, including those that are ignored by default;
# but hide rate-limit warnings (because we deliberately don't throttle test user logins)
# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring)
filterwarnings = [
"default",
"ignore:No request passed to the backend, unable to rate-limit:UserWarning",
"ignore::xblock.exceptions.FieldDataDeprecationWarning",
# Remove default_app_config warning after updating Django to 4.2
"ignore:.*You can remove default_app_config.*:PendingDeprecationWarning",
"ignore:Instead access HTTPResponse.headers directly.*:DeprecationWarning:elasticsearch",
# ABC deprecation Warning comes from libsass
"ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated.*:DeprecationWarning:sass",
"ignore:'etree' is deprecated. Use 'xml.etree.ElementTree' instead.:DeprecationWarning:wiki",
]
junit_family = "xunit2"
norecursedirs = ". .* *.egg build conf dist node_modules test_root cms/envs lms/envs openedx/envs"
python_classes = []
python_files = ["tests.py", "test_*.py", "tests_*.py", "*_tests.py", "__init__.py"]

View File

@@ -1,29 +1,3 @@
[tool:pytest]
# Note: The first file of settings found is used, there is no combining, so
# this file is only used for tests that don't find a pytest.ini file first.
# Details at https://docs.pytest.org/en/latest/reference/customize.html
DJANGO_SETTINGS_MODULE = lms.envs.test
addopts = --nomigrations --reuse-db --durations=20 --json-report --json-report-omit keywords streams collectors log traceback tests --json-report-file=none
# Enable default handling for all warnings, including those that are ignored by default;
# but hide rate-limit warnings (because we deliberately don't throttle test user logins)
# and field_data deprecation warnings (because fixing them requires a major low-priority refactoring)
filterwarnings =
default
ignore:No request passed to the backend, unable to rate-limit:UserWarning
ignore::xblock.exceptions.FieldDataDeprecationWarning
# Remove default_app_config warning after updating Django to 4.2
ignore:.*You can remove default_app_config.*:PendingDeprecationWarning
ignore:Instead access HTTPResponse.headers directly.*:DeprecationWarning:elasticsearch
# ABC deprecation Warning comes from libsass
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated.*:DeprecationWarning:sass
ignore:'etree' is deprecated. Use 'xml.etree.ElementTree' instead.:DeprecationWarning:wiki
junit_family = xunit2
norecursedirs = .* *.egg build conf dist node_modules test_root cms/envs lms/envs openedx/envs
python_classes =
python_files = tests.py test_*.py tests_*.py *_tests.py __init__.py
[pycodestyle]
# error codes: https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
# E501: line too long