Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Introduce app_group flag (#5869)
Browse files Browse the repository at this point in the history
  • Loading branch information
tokejepsen authored Nov 7, 2023
1 parent ecc65d1 commit 414df23
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
7 changes: 5 additions & 2 deletions openpype/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ def run(script):
"--app_variant",
help="Provide specific app variant for test, empty for latest",
default=None)
@click.option("--app_group",
help="Provide specific app group for test, empty for default",
default=None)
@click.option("-t",
"--timeout",
help="Provide specific timeout value for test case",
Expand All @@ -294,11 +297,11 @@ def run(script):
help="MongoDB for testing.",
default=None)
def runtests(folder, mark, pyargs, test_data_folder, persist, app_variant,
timeout, setup_only, mongo_url):
timeout, setup_only, mongo_url, app_group):
"""Run all automatic tests after proper initialization via start.py"""
PypeCommands().run_tests(folder, mark, pyargs, test_data_folder,
persist, app_variant, timeout, setup_only,
mongo_url)
mongo_url, app_group)


@main.command(help="DEPRECATED - run sync server")
Expand Down
5 changes: 4 additions & 1 deletion openpype/pype_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def validate_jsons(self):

def run_tests(self, folder, mark, pyargs,
test_data_folder, persist, app_variant, timeout, setup_only,
mongo_url):
mongo_url, app_group):
"""
Runs tests from 'folder'
Expand Down Expand Up @@ -260,6 +260,9 @@ def run_tests(self, folder, mark, pyargs,
if persist:
args.extend(["--persist", persist])

if app_group:
args.extend(["--app_group", app_group])

if app_variant:
args.extend(["--app_variant", app_variant])

Expand Down
10 changes: 10 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ def pytest_addoption(parser):
help="True - keep test_db, test_openpype, outputted test files"
)

parser.addoption(
"--app_group", action="store", default=None,
help="Keep empty to use default application or explicit"
)

parser.addoption(
"--app_variant", action="store", default=None,
help="Keep empty to locate latest installed variant or explicit"
Expand Down Expand Up @@ -45,6 +50,11 @@ def persist(request):
return request.config.getoption("--persist")


@pytest.fixture(scope="module")
def app_group(request):
return request.config.getoption("--app_group")


@pytest.fixture(scope="module")
def app_variant(request):
return request.config.getoption("--app_variant")
Expand Down
9 changes: 6 additions & 3 deletions tests/lib/testing_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,22 @@ class PublishTest(ModuleUnitTest):
SETUP_ONLY = False

@pytest.fixture(scope="module")
def app_name(self, app_variant):
def app_name(self, app_variant, app_group):
"""Returns calculated value for ApplicationManager. Eg.(nuke/12-2)"""
from openpype.lib import ApplicationManager
app_variant = app_variant or self.APP_VARIANT
app_group = app_group or self.APP_GROUP

application_manager = ApplicationManager()
if not app_variant:
variant = (
application_manager.find_latest_available_variant_for_group(
self.APP_GROUP))
app_group
)
)
app_variant = variant.name

yield "{}/{}".format(self.APP_GROUP, app_variant)
yield "{}/{}".format(app_group, app_variant)

@pytest.fixture(scope="module")
def app_args(self, download_test_data):
Expand Down

0 comments on commit 414df23

Please sign in to comment.