This commit is contained in:
Rushabh Mehta 2014-07-14 16:44:27 +05:30 committed by Anand Doshi
parent 11aca930e8
commit be98dc03d3

View file

@ -97,9 +97,20 @@ def _run_unittest(module, verbose=False, tests=()):
def _add_test(path, filename, verbose, test_suite=None):
import os, imp
if os.path.sep.join("doctype", "doctype", "boilerplate") in path:
# in /doctype/doctype/boilerplate/
return
if not test_suite:
test_suite = unittest.TestSuite()
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)
module = imp.load_source(filename[:-3], os.path.join(path, filename))
test_suite.addTest(unittest.TestLoader().loadTestsFromModule(module))