@@ -200,24 +200,8 @@ def get_test_loop_count(self, test_id):
200
200
return result
201
201
202
202
def file_copy_method_selector (self , image_path , disk , copy_method ):
203
- """ Copy file depending on method you want to use """
204
- # TODO: Add exception handling for copy procedures (disk can be full). See below.
205
- """
206
- Traceback (most recent call last):
207
- File "mbed\workspace_tools\singletest.py", line 738, in <module>
208
- single_test_result = single_test.handle(test_spec, target, toolchain)
209
- File "mbed\workspace_tools\singletest.py", line 252, in handle
210
- self.file_copy_method_selector(image_path, disk, opts.copy_method)
211
- File "mbed\workspace_tools\singletest.py", line 203, in file_copy_method_selector
212
- copy(image_path, disk)
213
- File "C:\Python27\lib\shutil.py", line 119, in copy
214
- copyfile(src, dst)
215
- File "C:\Python27\lib\shutil.py", line 84, in copyfile
216
- copyfileobj(fsrc, fdst)
217
- File "C:\Python27\lib\shutil.py", line 52, in copyfileobj
218
- fdst.write(buf)
219
- IOError: [Errno 28] No space left on device
220
- """
203
+ """ Copy file depending on method you want to use. Handles exception
204
+ and return code from shell copy commands. """
221
205
result = True
222
206
resutl_msg = ""
223
207
if copy_method == "cp" or copy_method == "copy" or copy_method == "xcopy" :
@@ -339,6 +323,9 @@ def shape_global_test_loop_result(self, test_all_result):
339
323
return result
340
324
341
325
def run_host_test (self , name , disk , port , duration , verbose = False , extra_serial = "" ):
326
+ """ Function creates new process with host test configured with particular test case.
327
+ Function also is pooling for serial port activity from process to catch all data
328
+ printed by test runner and host test during test execution."""
342
329
# print "{%s} port:%s disk:%s" % (name, port, disk),
343
330
cmd = ["python" , "%s.py" % name , '-p' , port , '-d' , disk , '-t' , str (duration ), "-e" , extra_serial ]
344
331
proc = Popen (cmd , stdout = PIPE , cwd = HOST_TESTS )
@@ -533,6 +520,9 @@ def print_test_configuration_from_json(json_data, join_delim=", "):
533
520
534
521
535
522
def get_avail_tests_summary_table (cols = None , result_summary = True , join_delim = ',' ):
523
+ """ Generates table summary with all test cases and additional test cases
524
+ information using pretty print functionality. Allows test suite user to
525
+ see test cases. """
536
526
# get all unique test ID prefixes
537
527
unique_test_id = []
538
528
for test in TESTS :
@@ -577,8 +567,8 @@ def get_avail_tests_summary_table(cols=None, result_summary=True, join_delim=','
577
567
# Update counters
578
568
counter_all += 1
579
569
counter_dict_test_id_types_all [test_id_prefix ] += 1
580
- print pt
581
- print
570
+ result = pt . get_string ()
571
+ result += " \n \n "
582
572
583
573
if result_summary :
584
574
# Automation result summary
@@ -591,9 +581,9 @@ def get_avail_tests_summary_table(cols=None, result_summary=True, join_delim=','
591
581
percent_progress = round (100.0 * counter_automated / float (counter_all ), 1 )
592
582
str_progress = progress_bar (percent_progress , 75 )
593
583
pt .add_row ([counter_automated , counter_all , percent_progress , str_progress ])
594
- print "Automation coverage:"
595
- print pt
596
- print
584
+ result += "Automation coverage:\n "
585
+ result += pt . get_string ()
586
+ result += " \n \n "
597
587
598
588
# Test automation coverage table print
599
589
test_id_cols = ['id' , 'automated' , 'all' , 'percent [%]' , 'progress' ]
@@ -612,10 +602,10 @@ def get_avail_tests_summary_table(cols=None, result_summary=True, join_delim=','
612
602
percent_progress ,
613
603
"[" + str_progress + "]" ]
614
604
pt .add_row (row )
615
- print "Test automation coverage:"
616
- print pt
617
- print
618
-
605
+ result += "Test automation coverage:\n "
606
+ result += pt . get_string ()
607
+ result += " \n \n "
608
+ return result
619
609
620
610
def progress_bar (percent_progress , saturation = 0 ):
621
611
""" This function creates progress bar with optional simple saturation mark"""
@@ -834,13 +824,13 @@ def generate_test_summary(test_summary):
834
824
835
825
# Print summary / information about automation test status
836
826
if opts .test_automation_report :
837
- get_avail_tests_summary_table ()
827
+ print get_avail_tests_summary_table ()
838
828
exit (0 )
839
829
840
830
# Print summary / information about automation test status
841
831
if opts .test_case_report :
842
832
test_case_report_cols = ['id' , 'automated' , 'description' , 'peripherals' , 'host_test' , 'duration' , 'source_dir' ]
843
- get_avail_tests_summary_table (cols = test_case_report_cols , result_summary = False , join_delim = '\n ' )
833
+ print get_avail_tests_summary_table (cols = test_case_report_cols , result_summary = False , join_delim = '\n ' )
844
834
exit (0 )
845
835
846
836
# Only prints matrix of supported toolchains
0 commit comments