mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
testing: improving test module unit test class
This commit is contained in:
parent
e8af8559fd
commit
ff9edbdc26
1 changed files with 11 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ import re
|
||||||
from tests.lib.db_handler import DBHandler
|
from tests.lib.db_handler import DBHandler
|
||||||
from common.openpype_common.distribution.file_handler import RemoteFileHandler
|
from common.openpype_common.distribution.file_handler import RemoteFileHandler
|
||||||
from openpype.modules import ModulesManager
|
from openpype.modules import ModulesManager
|
||||||
|
from openpype.settings import get_project_settings
|
||||||
|
|
||||||
|
|
||||||
class BaseTest:
|
class BaseTest:
|
||||||
|
|
@ -28,6 +29,7 @@ class ModuleUnitTest(BaseTest):
|
||||||
|
|
||||||
Implemented fixtures:
|
Implemented fixtures:
|
||||||
monkeypatch_session - fixture for env vars with session scope
|
monkeypatch_session - fixture for env vars with session scope
|
||||||
|
project_settings - fixture for project settings with session scope
|
||||||
download_test_data - tmp folder with extracted data from GDrive
|
download_test_data - tmp folder with extracted data from GDrive
|
||||||
env_var - sets env vars from input file
|
env_var - sets env vars from input file
|
||||||
db_setup - prepares avalon AND openpype DBs for testing from
|
db_setup - prepares avalon AND openpype DBs for testing from
|
||||||
|
|
@ -59,6 +61,12 @@ class ModuleUnitTest(BaseTest):
|
||||||
yield m
|
yield m
|
||||||
m.undo()
|
m.undo()
|
||||||
|
|
||||||
|
@pytest.fixture(scope='module')
|
||||||
|
def project_settings(self):
|
||||||
|
yield get_project_settings(
|
||||||
|
self.PROJECT
|
||||||
|
)
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
def download_test_data(self, test_data_folder, persist, request):
|
def download_test_data(self, test_data_folder, persist, request):
|
||||||
test_data_folder = test_data_folder or self.TEST_DATA_FOLDER
|
test_data_folder = test_data_folder or self.TEST_DATA_FOLDER
|
||||||
|
|
@ -159,7 +167,9 @@ class ModuleUnitTest(BaseTest):
|
||||||
"""
|
"""
|
||||||
from openpype.pipeline import AvalonMongoDB
|
from openpype.pipeline import AvalonMongoDB
|
||||||
dbcon = AvalonMongoDB()
|
dbcon = AvalonMongoDB()
|
||||||
dbcon.Session["AVALON_PROJECT"] = self.TEST_PROJECT_NAME
|
dbcon.Session["AVALON_PROJECT"] = self.PROJECT
|
||||||
|
dbcon.Session["AVALON_ASSET"] = self.ASSET
|
||||||
|
dbcon.Session["AVALON_TASK"] = self.TASK
|
||||||
yield dbcon
|
yield dbcon
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue