mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
OP-3426 - refactor - cleaned up cli arguments
This commit is contained in:
parent
90bc39b4d4
commit
058d4014a8
4 changed files with 13 additions and 19 deletions
|
|
@ -24,6 +24,8 @@ from .pype_commands import PypeCommands
|
|||
help=("Enable debug"))
|
||||
@click.option("--verbose", expose_value=False,
|
||||
help=("Change OpenPype log level (debug - critical or 0-50)"))
|
||||
@click.option("--automatic-tests", is_flag=True, expose_value=False,
|
||||
help=("Run in automatic tests mode"))
|
||||
def main(ctx):
|
||||
"""Pype is main command serving as entry point to pipeline system.
|
||||
|
||||
|
|
@ -127,11 +129,7 @@ def webpublisherwebserver(executable, upload_dir, host=None, port=None):
|
|||
@click.option(
|
||||
"--envgroup", help="Environment group (e.g. \"farm\")", default=None
|
||||
)
|
||||
@click.option(
|
||||
"--automatic_tests", help="Is this automatic test", default=None
|
||||
)
|
||||
def extractenvironments(output_json_path, project, asset, task, app, envgroup,
|
||||
automatic_tests):
|
||||
def extractenvironments(output_json_path, project, asset, task, app, envgroup):
|
||||
"""Extract environment variables for entered context to a json file.
|
||||
|
||||
Entered output filepath will be created if does not exists.
|
||||
|
|
@ -152,10 +150,7 @@ def extractenvironments(output_json_path, project, asset, task, app, envgroup,
|
|||
multiple=True)
|
||||
@click.option("-g", "--gui", is_flag=True,
|
||||
help="Show Publish UI", default=False)
|
||||
@click.option(
|
||||
"--automatic_tests", help="Is this automatic test", default=None
|
||||
)
|
||||
def publish(paths, targets, gui, automatic_tests):
|
||||
def publish(paths, targets, gui):
|
||||
"""Start CLI publishing.
|
||||
|
||||
Publish collects json from paths provided as an argument.
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
|
|||
]
|
||||
|
||||
if os.environ.get("IS_TEST"):
|
||||
args.extend(["--automatic_tests", "1"])
|
||||
args.append("--automatic-tests")
|
||||
|
||||
# Generate the payload for Deadline submission
|
||||
payload = {
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ def inject_openpype_environment(deadlinePlugin):
|
|||
add_args["envgroup"] = "farm"
|
||||
|
||||
if job.GetJobEnvironmentKeyValue('IS_TEST'):
|
||||
add_args["automatic_tests"] = "true"
|
||||
args.append("--automatic-tests")
|
||||
|
||||
if all(add_args.values()):
|
||||
for key, value in add_args.items():
|
||||
|
|
|
|||
15
start.py
15
start.py
|
|
@ -242,6 +242,10 @@ if "--debug" in sys.argv:
|
|||
sys.argv.remove("--debug")
|
||||
os.environ["OPENPYPE_DEBUG"] = "1"
|
||||
|
||||
if "--automatic-tests" in sys.argv:
|
||||
sys.argv.remove("--automatic-tests")
|
||||
os.environ["IS_TEST"] = "1"
|
||||
|
||||
|
||||
import igniter # noqa: E402
|
||||
from igniter import BootstrapRepos # noqa: E402
|
||||
|
|
@ -486,7 +490,6 @@ def _process_arguments() -> tuple:
|
|||
use_version = None
|
||||
use_staging = False
|
||||
commands = []
|
||||
automatic_tests = False
|
||||
|
||||
# OpenPype version specification through arguments
|
||||
use_version_arg = "--use-version"
|
||||
|
|
@ -571,10 +574,7 @@ def _process_arguments() -> tuple:
|
|||
sys.argv.pop(idx)
|
||||
sys.argv.insert(idx, "tray")
|
||||
|
||||
if "--automatic_tests" in sys.argv:
|
||||
automatic_tests = True
|
||||
|
||||
return use_version, use_staging, commands, automatic_tests
|
||||
return use_version, use_staging, commands
|
||||
|
||||
|
||||
def _determine_mongodb() -> str:
|
||||
|
|
@ -1001,7 +1001,7 @@ def boot():
|
|||
# Process arguments
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
use_version, use_staging, commands, automatic_tests = _process_arguments()
|
||||
use_version, use_staging, commands = _process_arguments()
|
||||
|
||||
if os.getenv("OPENPYPE_VERSION"):
|
||||
if use_version:
|
||||
|
|
@ -1028,9 +1028,8 @@ def boot():
|
|||
os.environ["OPENPYPE_DATABASE_NAME"] = \
|
||||
os.environ.get("OPENPYPE_DATABASE_NAME") or "openpype"
|
||||
|
||||
if automatic_tests:
|
||||
if os.environ.get("IS_TEST") == "1":
|
||||
# change source DBs to predefined ones set for automatic testing
|
||||
os.environ["IS_TEST"] = "1"
|
||||
os.environ["OPENPYPE_DATABASE_NAME"] += "_tests"
|
||||
avalon_db = os.environ.get("AVALON_DB") or "avalon"
|
||||
os.environ["AVALON_DB"] = avalon_db + "_tests"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue