From a92b77cf6bd7c2313b2b7b2de7a161da3a520d43 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Thu, 8 Feb 2024 18:06:36 +0100 Subject: [PATCH] removed 'run_tests' command --- client/ayon_core/cli.py | 47 -------------------- client/ayon_core/cli_commands.py | 75 -------------------------------- 2 files changed, 122 deletions(-) diff --git a/client/ayon_core/cli.py b/client/ayon_core/cli.py index c2e5c99419..0a30877cb2 100644 --- a/client/ayon_core/cli.py +++ b/client/ayon_core/cli.py @@ -183,53 +183,6 @@ def run(script): runpy.run_path(script, run_name="__main__", ) -@main_cli.command() -@click.argument("folder", nargs=-1) -@click.option("-m", - "--mark", - help="Run tests marked by", - default=None) -@click.option("-p", - "--pyargs", - help="Run tests from package", - default=None) -@click.option("-t", - "--test_data_folder", - help="Unzipped directory path of test file", - default=None) -@click.option("-s", - "--persist", - help="Persist test DB and published files after test end", - default=None) -@click.option("-a", - "--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", - default=None) -@click.option("-so", - "--setup_only", - help="Only create dbs, do not run tests", - default=None) -@click.option("--mongo_url", - help="MongoDB for testing.", - default=None) -@click.option("--dump_databases", - help="Dump all databases to data folder.", - default=None) -def runtests(folder, mark, pyargs, test_data_folder, persist, app_variant, - timeout, setup_only, mongo_url, app_group, dump_databases): - """Run all automatic tests after proper initialization via start.py""" - Commands.run_tests(folder, mark, pyargs, test_data_folder, - persist, app_variant, timeout, setup_only, - mongo_url, app_group, dump_databases) - - @main_cli.command() def interactive(): """Interactive (Python like) console. diff --git a/client/ayon_core/cli_commands.py b/client/ayon_core/cli_commands.py index fb4a72736f..c07b72afdf 100644 --- a/client/ayon_core/cli_commands.py +++ b/client/ayon_core/cli_commands.py @@ -171,78 +171,3 @@ class Commands: from ayon_core.tools.context_dialog import main main(output_path, project_name, asset_name, strict) - - @staticmethod - def run_tests(folder, mark, pyargs, - test_data_folder, persist, app_variant, timeout, setup_only, - mongo_url, app_group, dump_databases): - """ - Runs tests from 'folder' - - Args: - folder (str): relative path to folder with tests - mark (str): label to run tests marked by it (slow etc) - pyargs (str): package path to test - test_data_folder (str): url to unzipped folder of test data - persist (bool): True if keep test db and published after test - end - app_variant (str): variant (eg 2020 for AE), empty if use - latest installed version - timeout (int): explicit timeout for single test - setup_only (bool): if only preparation steps should be - triggered, no tests (useful for debugging/development) - mongo_url (str): url to Openpype Mongo database - """ - print("run_tests") - if folder: - folder = " ".join(list(folder)) - else: - folder = "../tests" - - # disable warnings and show captured stdout even if success - args = [ - "--disable-pytest-warnings", - "--capture=sys", - "--print", - "-W ignore::DeprecationWarning", - "-rP", - folder - ] - - if mark: - args.extend(["-m", mark]) - - if pyargs: - args.extend(["--pyargs", pyargs]) - - if test_data_folder: - args.extend(["--test_data_folder", test_data_folder]) - - if persist: - args.extend(["--persist", persist]) - - if app_group: - args.extend(["--app_group", app_group]) - - if app_variant: - args.extend(["--app_variant", app_variant]) - - if timeout: - args.extend(["--timeout", timeout]) - - if setup_only: - args.extend(["--setup_only", setup_only]) - - if mongo_url: - args.extend(["--mongo_url", mongo_url]) - - if dump_databases: - msg = "dump_databases format is not recognized: {}".format( - dump_databases - ) - assert dump_databases in ["bson", "json"], msg - args.extend(["--dump_databases", dump_databases]) - - print("run_tests args: {}".format(args)) - import pytest - pytest.main(args)