Moved hooks around (#23077)

This change only implements pytest hooks when we know pytest_json_report plugin has
been loaded. Previously, the hooks were being loaded before plugin, thus causing errors
cause(pytest_sessionfinish needs the plugin to function).
This commit is contained in:
Manjinder Singh
2020-02-11 10:38:36 -05:00
committed by GitHub
parent cce8cdd661
commit 03a3c201cb
2 changed files with 4 additions and 4 deletions

View File

@@ -12,8 +12,7 @@ import os
import contracts
import pytest
from openedx.core.pytest_hooks import pytest_json_modifyreport # pylint: disable=unused-import
from openedx.core.pytest_hooks import pytest_sessionfinish # pylint: disable=unused-import
from openedx.core.pytest_hooks import DeferPlugin
# Patch the xml libs before anything else.
@@ -35,6 +34,9 @@ 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():

View File

@@ -10,8 +10,6 @@ import pytest
# avoid duplicating the implementation
from cms.conftest import _django_clear_site_cache, pytest_configure # pylint: disable=unused-import
from openedx.core.pytest_hooks import pytest_json_modifyreport # pylint: disable=unused-import
from openedx.core.pytest_hooks import pytest_sessionfinish # pylint: disable=unused-import
# When using self.assertEquals, diffs are truncated. We don't want that, always