r16449 - gnucash/branches/dogtail/src/test-dogtail - update validation to handle filtering,
Ahmed Sayed
asayed at cvs.gnucash.org
Sat Aug 18 17:44:21 EDT 2007
Author: asayed
Date: 2007-08-18 17:44:21 -0400 (Sat, 18 Aug 2007)
New Revision: 16449
Trac: http://svn.gnucash.org/trac/changeset/16449
Modified:
gnucash/branches/dogtail/src/test-dogtail/validator.py
Log:
update validation to handle filtering,
add a new generic validator method which diff files only
Modified: gnucash/branches/dogtail/src/test-dogtail/validator.py
===================================================================
--- gnucash/branches/dogtail/src/test-dogtail/validator.py 2007-08-18 15:48:13 UTC (rev 16448)
+++ gnucash/branches/dogtail/src/test-dogtail/validator.py 2007-08-18 21:44:21 UTC (rev 16449)
@@ -28,7 +28,7 @@
EXIT_FAILURE = 1
EXIT_TROUBLE = 2
-def validate_node (node, testname, ref_filename=None, act_filename=None):
+def validate_node (node, testname, ref_filename=None, act_filename=None, filter_command=None):
"""
brows the children and out the result to file hold the same method name concatenated with _act to be diffed with the testcase name concatenated with _ref
if i have a testcase called test1
@@ -41,10 +41,28 @@
act_file = open(act_filename, 'w')
generate_act_file (node, act_file)
act_file.close()
- # get divided 265 to get the exact system status
- error_code = os.system("diff %s %s" % (act_filename, ref_filename))/256
+ # divided by 265 to get the exact system status
+ if filter_command != None:
+ os.system("sed -n %s < %s >%s" % (filter_command, act_filename, act_filename+"_filtered"))
+ os.system("sed -n %s < %s >%s" % (filter_command, ref_filename, ref_filename+"_filtered"))
+ error_code = os.system("diff %s %s" % (act_filename+"_filtered", ref_filename+"_filtered"))/256
+ else:
+ error_code = os.system("diff %s %s" % (act_filename, ref_filename))/256
return error_code
+def validate_files(testname, ref_filename=None, act_filename=None, filter_command=None):
+ if act_filename == None:
+ act_filename = 'act/%s_act' % (testname)
+ if ref_filename == None:
+ ref_filename = 'ref/%s_ref' % (testname)
+ if filter_command != None:
+ os.system("sed -n %s < %s > %s" % (filter_command, act_filename, act_filename+"_filtered"))
+ os.system("sed -n %s < %s > %s" % (filter_command, ref_filename, ref_filename+"_filtered"))
+ error_code = os.system("diff %s %s" % (act_filename+"_filtered", ref_filename+"_filtered"))/256
+ else:
+ error_code = os.system("diff %s %s" % (act_filename, ref_filename))/256
+ return error_code
+
def generate_act_file (node, file, depth = 0):
""" helper method that Generate the act file, The file Generated in the testcase """
file.write(spacer*(depth) + str (node) + '\n' )
@@ -54,3 +72,5 @@
except AttributeError:
pass
+if __name__ == '__main__':
+ validate_files('/home/ahmed/act', '/home/ahmed/ref', "\'/TABLE/,/\/TABLE/p\'")
More information about the gnucash-changes
mailing list