@@ -31,6 +31,9 @@ def tearDownClass(cls) -> None:
3131 os .system (f"rm -rf { tmp_dir } " )
3232 return
3333
34+ def clean_console_output (text ):
35+ return text .replace ('\r ' , '' ).strip ()
36+
3437 def check_stream_output (self , code , expected_output , stream = "stdout" ):
3538 self .flush_channels ()
3639 reply , output_msgs = self .execute_helper (code = code )
@@ -44,10 +47,14 @@ def check_stream_output(self, code, expected_output, stream="stdout"):
4447
4548 if msg ["header" ]["msg_type" ] == "stream" :
4649 # self.assertEqual(msg["content"]["name"], stream)
47- self .assertEqual (msg ["content" ]["text" ], expected_msg )
50+ self .assertEqual (
51+ clean_console_output (msg ["content" ]["text" ]),
52+ clean_console_output (expected_msg )
53+ )
4854 elif msg ["header" ]["msg_type" ] == "execute_result" :
4955 self .assertEqual (
50- msg ["content" ]["data" ]["text/plain" ], expected_msg
56+ clean_console_output (msg ["content" ]["data" ]["text/plain" ]),
57+ clean_console_output (expected_msg )
5158 )
5259
5360
@@ -70,7 +77,6 @@ def test_01_scorep_pythonargs(self):
7077 def test_02_ipykernel_exec (self ):
7178 self .check_from_file ("tests/kernel/ipykernel_exec.yaml" )
7279
73-
7480 def test_03_scorep_exec (self ):
7581 self .check_from_file ("tests/kernel/scorep_exec.yaml" )
7682
@@ -84,5 +90,9 @@ def test_06_writemode(self):
8490 self .check_from_file ("tests/kernel/writemode.yaml" )
8591
8692
93+ def clean_console_output (text ):
94+ return text .replace ('\r ' , '' ).strip ()
95+
96+
8797if __name__ == "__main__" :
8898 unittest .main ()
0 commit comments