#NEWLINE# def get_test_doclist( doctype , name = None ) : #NEWLINE# #INDENT# 'get test doclist, collection of doclists' #NEWLINE# import os , frappe #NEWLINE# from frappe import conf #NEWLINE# from frappe.modules.utils import peval_doclist #NEWLINE# from frappe.modules import scrub #NEWLINE# doctype = scrub ( doctype ) #NEWLINE# doctype_path = os . path . join ( os . path . dirname ( os . path . abspath ( conf . __file__ ) ) , conf . test_data_path , doctype ) #NEWLINE# if name : #NEWLINE# #INDENT# with open ( os . path . join ( doctype_path , ( scrub ( name ) + '.json' ) ) , 'r' ) as txtfile : #NEWLINE# #INDENT# doclist = peval_doclist ( txtfile . read ( ) ) #NEWLINE# #UNINDENT# return doclist #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# all_doclists = [ ] #NEWLINE# for fname in filter ( ( lambda n : n . endswith ( '.json' ) ) , os . listdir ( doctype_path ) ) : #NEWLINE# #INDENT# with open ( os . path . join ( doctype_path , scrub ( fname ) ) , 'r' ) as txtfile : #NEWLINE# #INDENT# all_doclists . append ( peval_doclist ( txtfile . read ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return all_doclists