feat: run tests all doctypes in module def

This commit is contained in:
ruthra kumar 2022-06-08 07:01:53 +05:30
parent eac73f6765
commit a202f1a621
2 changed files with 11 additions and 0 deletions

View file

@ -730,6 +730,7 @@ def transform_database(context, table, engine, row_format, failfast):
@click.command("run-tests")
@click.option("--app", help="For App")
@click.option("--doctype", help="For DocType")
@click.option("--module-def", help="For all Doctypes in Module Def")
@click.option("--case", help="Select particular TestCase")
@click.option(
"--doctype-list-path",
@ -754,6 +755,7 @@ def run_tests(
app=None,
module=None,
doctype=None,
module_def=None,
test=(),
profile=False,
coverage=False,
@ -790,6 +792,7 @@ def run_tests(
app,
module,
doctype,
module_def,
context.verbose,
tests=tests,
force=context.force,

View file

@ -41,6 +41,7 @@ def main(
app=None,
module=None,
doctype=None,
module_def=None,
verbose=False,
tests=(),
force=False,
@ -97,6 +98,13 @@ def main(
ret = run_tests_for_doctype(
doctype, verbose, tests, force, profile, failfast=failfast, junit_xml_output=junit_xml_output
)
elif module_def:
doctypes = frappe.db.get_list(
"DocType", filters={"module": module_def, "istable": 0}, pluck="name"
)
ret = run_tests_for_doctype(
doctypes, verbose, tests, force, profile, failfast=failfast, junit_xml_output=junit_xml_output
)
elif module:
ret = run_tests_for_module(
module,