mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
#1784 - init commit of pype command
Pype command is better than run_tests.ps1 as OP is initialized by start.py. This is more similar to standard running of OP
This commit is contained in:
parent
331de6de75
commit
777facc69c
2 changed files with 36 additions and 0 deletions
|
|
@ -283,3 +283,18 @@ def run(script):
|
|||
args_string = " ".join(args[1:])
|
||||
print(f"... running: {script} {args_string}")
|
||||
runpy.run_path(script, run_name="__main__", )
|
||||
|
||||
|
||||
@main.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)
|
||||
def runtests(folder, mark, pyargs):
|
||||
"""Run all automatic tests after proper initialization via start.py"""
|
||||
PypeCommands().run_tests(folder, mark, pyargs)
|
||||
|
|
|
|||
|
|
@ -257,3 +257,24 @@ class PypeCommands:
|
|||
def validate_jsons(self):
|
||||
pass
|
||||
|
||||
def run_tests(self, folder, mark, pyargs):
|
||||
"""
|
||||
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
|
||||
"""
|
||||
print("run_tests")
|
||||
import subprocess
|
||||
folder = folder or "../tests"
|
||||
mark_str = pyargs_str = ''
|
||||
if mark:
|
||||
mark_str = "- m {}".format(mark)
|
||||
|
||||
if pyargs:
|
||||
pyargs_str = "--pyargs {}".format(pyargs)
|
||||
|
||||
subprocess.run("pytest {} {} {}".format(folder, mark_str, pyargs_str))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue