fix(test_runner): Load file if exists

This commit is contained in:
Faris Ansari 2019-09-25 23:31:08 +05:30
parent 5e8a56b444
commit 44028ce23a

View file

@ -250,10 +250,11 @@ def _add_test(app, path, filename, verbose, test_suite=None, ui_tests=False):
if os.path.basename(os.path.dirname(path))=="doctype":
txt_file = os.path.join(path, filename[5:].replace(".py", ".json"))
with open(txt_file, 'r') as f:
doc = json.loads(f.read())
doctype = doc["name"]
make_test_records(doctype, verbose)
if os.path.exists(txt_file):
with open(txt_file, 'r') as f:
doc = json.loads(f.read())
doctype = doc["name"]
make_test_records(doctype, verbose)
test_suite.addTest(unittest.TestLoader().loadTestsFromModule(module))
@ -417,4 +418,4 @@ def get_test_record_log():
else:
frappe.flags.test_record_log = []
return frappe.flags.test_record_log
return frappe.flags.test_record_log