diff --git a/cms/conftest.py b/cms/conftest.py index e0a774b805..f937c14e81 100644 --- a/cms/conftest.py +++ b/cms/conftest.py @@ -9,6 +9,7 @@ only running cms tests. import importlib import os +import logging import contracts import pytest @@ -24,6 +25,11 @@ def pytest_configure(config): """ Do core setup operations from manage.py before collecting tests. """ + if config.pluginmanager.hasplugin("pytest_jsonreport") or config.pluginmanager.hasplugin("json-report"): + config.pluginmanager.register(DeferPlugin()) + else: + logging.info("pytest did not register json_report correctly") + if config.getoption('help'): return enable_contracts = os.environ.get('ENABLE_CONTRACTS', False) @@ -34,9 +40,6 @@ def pytest_configure(config): startup = importlib.import_module(startup_module) startup.run() - if config.pluginmanager.hasplugin("json-report"): - config.pluginmanager.register(DeferPlugin()) - @pytest.fixture(autouse=True, scope='function') def _django_clear_site_cache(): diff --git a/cms/pytest.ini b/cms/pytest.ini index fef2586afa..2ef7c09ea3 100644 --- a/cms/pytest.ini +++ b/cms/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = cms.envs.test -addopts = --nomigrations --reuse-db --durations=20 -p no:randomly +addopts = --nomigrations --reuse-db --durations=20 -p no:randomly --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) diff --git a/common/lib/pytest.ini b/common/lib/pytest.ini index d8686445fd..9f9b54a12c 100644 --- a/common/lib/pytest.ini +++ b/common/lib/pytest.ini @@ -1,6 +1,6 @@ [pytest] DJANGO_SETTINGS_MODULE = openedx.tests.settings -addopts = --nomigrations --reuse-db --durations=20 +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) diff --git a/common/test/pytest.ini b/common/test/pytest.ini index 20eabbe56e..29effd3a75 100644 --- a/common/test/pytest.ini +++ b/common/test/pytest.ini @@ -1,5 +1,5 @@ [pytest] -addopts = -p no:randomly --durations=20 +addopts = -p no:randomly --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) diff --git a/openedx/core/pytest_hooks.py b/openedx/core/pytest_hooks.py index 0ec2e3e996..211680d362 100644 --- a/openedx/core/pytest_hooks.py +++ b/openedx/core/pytest_hooks.py @@ -75,5 +75,5 @@ class DeferPlugin(object): def pytest_configure(config): - if config.pluginmanager.hasplugin("json-report"): + if config.pluginmanager.hasplugin("pytest_jsonreport") or config.pluginmanager.hasplugin("json-report"): config.pluginmanager.register(DeferPlugin())