fix: run-tests --module-def as not all doctypes are guaranteed to have test_*.py files
This commit is contained in:
parent
1640aaad04
commit
ee50e6c534
1 changed files with 15 additions and 2 deletions
|
|
@ -89,9 +89,22 @@ def main(
|
|||
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"
|
||||
doctypes = []
|
||||
doctypes_ = frappe.get_list(
|
||||
"DocType",
|
||||
filters={"module": module_def, "istable": 0},
|
||||
fields=["name", "module"],
|
||||
as_list=True,
|
||||
)
|
||||
for doctype, module in doctypes_:
|
||||
test_module = get_module_name(doctype, module, "test_", app=app)
|
||||
try:
|
||||
importlib.import_module(test_module)
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
doctypes.append(doctype)
|
||||
|
||||
ret = run_tests_for_doctype(
|
||||
doctypes, verbose, tests, force, profile, failfast=failfast, junit_xml_output=junit_xml_output
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue