ayon-core/tests/conftest.py
Petr Kalis 412d03d382 Merge fixes for tests from branch with Deadline tests.
Branch with newly implemented DL tests is targetted to release 3.15, but changes from it affects tests in develop.
This branch should solve issues with automatic tests in develop without need of full release 3.15 changes.
2022-12-02 15:52:04 +01:00

57 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
# adds command line arguments for 'runtests' as a fixtures
import pytest
def pytest_addoption(parser):
parser.addoption(
"--test_data_folder", action="store", default=None,
help="Provide url of a folder of unzipped test file"
)
parser.addoption(
"--persist", action="store", default=None,
help="True - keep test_db, test_openpype, outputted test files"
)
parser.addoption(
"--app_variant", action="store", default=None,
help="Keep empty to locate latest installed variant or explicit"
)
parser.addoption(
"--timeout", action="store", default=None,
help="Overwrite default timeout"
)
@pytest.fixture(scope="module")
def test_data_folder(request):
return request.config.getoption("--test_data_folder")
@pytest.fixture(scope="module")
def persist(request):
return request.config.getoption("--persist")
@pytest.fixture(scope="module")
def app_variant(request):
return request.config.getoption("--app_variant")
@pytest.fixture(scope="module")
def timeout(request):
return request.config.getoption("--timeout")
@pytest.hookimpl(tryfirst=True, hookwrapper=True)
def pytest_runtest_makereport(item, call):
# execute all other hooks to obtain the report object
outcome = yield
rep = outcome.get_result()
# set a report attribute for each phase of a call, which can
# be "setup", "call", "teardown"
setattr(item, "rep_" + rep.when, rep)