@@ -533,36 +533,36 @@ def test_print_dot(self):
533
533
534
534
535
535
class TestCmdLine (unittest .TestCase ):
536
- def get_main_stderr (self , new_args ):
536
+ def get_main_output (self , new_args ):
537
537
process = subprocess .Popen ([
538
538
sys .executable ,
539
539
"-m" ,
540
540
"cwltool"
541
541
] + new_args , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
542
542
543
543
stdout , stderr = process .communicate ()
544
- return process .returncode , stderr .decode ()
544
+ return process .returncode , stdout . decode (), stderr .decode ()
545
545
546
546
547
547
class TestJsConsole (TestCmdLine ):
548
548
549
549
def test_js_console_cmd_line_tool (self ):
550
550
for test_file in ("js_output.cwl" , "js_output_workflow.cwl" ):
551
- error_code , output = self .get_main_stderr (["--js-console" , "--no-container" ,
552
- get_data ("tests/wf/" + test_file )])
551
+ error_code , stdout , stderr = self .get_main_output (["--js-console" , "--no-container" ,
552
+ get_data ("tests/wf/" + test_file )])
553
553
554
- self .assertIn ("[log] Log message" , output )
555
- self .assertIn ("[err] Error message" , output )
554
+ self .assertIn ("[log] Log message" , stderr )
555
+ self .assertIn ("[err] Error message" , stderr )
556
556
557
- self .assertEquals (error_code , 0 , output )
557
+ self .assertEquals (error_code , 0 , stderr )
558
558
559
559
def test_no_js_console (self ):
560
560
for test_file in ("js_output.cwl" , "js_output_workflow.cwl" ):
561
- error_code , output = self .get_main_stderr (["--no-container" ,
562
- get_data ("tests/wf/" + test_file )])
561
+ error_code , stdout , stderr = self .get_main_output (["--no-container" ,
562
+ get_data ("tests/wf/" + test_file )])
563
563
564
- self .assertNotIn ("[log] Log message" , output )
565
- self .assertNotIn ("[err] Error message" , output )
564
+ self .assertNotIn ("[log] Log message" , stderr )
565
+ self .assertNotIn ("[err] Error message" , stderr )
566
566
567
567
568
568
@pytest .mark .skipif (onWindows (),
@@ -571,11 +571,35 @@ def test_no_js_console(self):
571
571
class TestCache (TestCmdLine ):
572
572
def test_wf_without_container (self ):
573
573
test_file = "hello-workflow.cwl"
574
- error_code , output = self .get_main_stderr (["--cachedir" , "cache" ,
575
- get_data ("tests/wf/" + test_file ), "--usermessage" , "hello" ])
576
- self .assertIn ("completed success" , output )
574
+ error_code , stdout , stderr = self .get_main_output (["--cachedir" , "cache" ,
575
+ get_data ("tests/wf/" + test_file ), "--usermessage" , "hello" ])
576
+ self .assertIn ("completed success" , stderr )
577
577
self .assertEquals (error_code , 0 )
578
578
579
+ @pytest .mark .skipif (onWindows (),
580
+ reason = "Instance of cwltool is used, on Windows it invokes a default docker container"
581
+ "which is not supported on AppVeyor" )
582
+ class TestChecksum (TestCmdLine ):
583
+
584
+ def test_compute_checksum (self ):
585
+ f = cwltool .factory .Factory (compute_checksum = True , use_container = False )
586
+ echo = f .make (get_data ("tests/wf/revsort.cwl" ))
587
+ output = echo (file1 = {
588
+ "class" : "File" ,
589
+ "location" : "tests/wf/whale.txt"
590
+ }
591
+ )
592
+ self .assertEquals (output ['output' ]["checksum" ], "sha1$57072443aa2d62f2ca17cb2f69b9f5184f57ba59" )
593
+
594
+ def test_no_compute_checksum (self ):
595
+ test_file = "tests/wf/wc-tool.cwl"
596
+ job_file = "tests/wf/wc-job.json"
597
+ error_code , stdout , stderr = self .get_main_output (["--no-compute-checksum" ,
598
+ get_data (test_file ), get_data (job_file )])
599
+ self .assertIn ("completed success" , stderr )
600
+ self .assertEquals (error_code , 0 )
601
+ self .assertNotIn ("checksum" , stdout )
602
+
579
603
580
604
if __name__ == '__main__' :
581
605
unittest .main ()
0 commit comments