@@ -541,9 +541,6 @@ def test_run_shell_cmd_fail(self):
541541 def handler (signum , _ ):
542542 raise RuntimeError ("Signal handler called with signal %s" % signum )
543543
544- # disable trace output for this test (so stdout remains empty)
545- update_build_option ('trace' , False )
546-
547544 orig_sigalrm_handler = signal .getsignal (signal .SIGALRM )
548545
549546 try :
@@ -811,6 +808,8 @@ def test_run_shell_cmd_split_stderr(self):
811808 def test_run_cmd_trace (self ):
812809 """Test run_cmd in trace mode, and with tracing disabled."""
813810
811+ update_build_option ('trace' , True )
812+
814813 # use of run_cmd is deprecated, so we need to allow it here
815814 self .allow_deprecated_behaviour ()
816815
@@ -837,8 +836,7 @@ def test_run_cmd_trace(self):
837836 regex = re .compile ('\n ' .join (pattern ))
838837 self .assertTrue (regex .search (stdout ), "Pattern '%s' found in: %s" % (regex .pattern , stdout ))
839838
840- init_config (build_options = {'trace' : False })
841-
839+ update_build_option ('trace' , False )
842840 self .mock_stdout (True )
843841 self .mock_stderr (True )
844842 (out , ec ) = run_cmd ("echo hello" )
@@ -851,9 +849,8 @@ def test_run_cmd_trace(self):
851849 self .assertTrue (stderr .strip ().startswith ("WARNING: Deprecated functionality" ))
852850 self .assertEqual (stdout , '' )
853851
854- init_config (build_options = {'trace' : True })
855-
856852 # also test with command that is fed input via stdin
853+ update_build_option ('trace' , True )
857854 self .mock_stdout (True )
858855 self .mock_stderr (True )
859856 (out , ec ) = run_cmd ('cat' , inp = 'hello' )
@@ -869,8 +866,7 @@ def test_run_cmd_trace(self):
869866 regex = re .compile ('\n ' .join (pattern ))
870867 self .assertTrue (regex .search (stdout ), "Pattern '%s' found in: %s" % (regex .pattern , stdout ))
871868
872- init_config (build_options = {'trace' : False })
873-
869+ update_build_option ('trace' , False )
874870 self .mock_stdout (True )
875871 self .mock_stderr (True )
876872 (out , ec ) = run_cmd ('cat' , inp = 'hello' )
@@ -902,6 +898,8 @@ def test_run_cmd_trace(self):
902898 def test_run_shell_cmd_trace (self ):
903899 """Test run_shell_cmd function in trace mode, and with tracing disabled."""
904900
901+ update_build_option ('trace' , True )
902+
905903 pattern = [
906904 r"^ >> running shell command:" ,
907905 r"\techo hello" ,
@@ -911,7 +909,6 @@ def test_run_shell_cmd_trace(self):
911909 r" >> command completed: exit 0, ran in .*" ,
912910 ]
913911
914- # trace output is enabled by default (since EasyBuild v5.0)
915912 self .mock_stdout (True )
916913 self .mock_stderr (True )
917914 res = run_shell_cmd ("echo hello" )
@@ -926,7 +923,6 @@ def test_run_shell_cmd_trace(self):
926923 self .assertTrue (regex .search (stdout ), "Pattern '%s' found in: %s" % (regex .pattern , stdout ))
927924
928925 init_config (build_options = {'trace' : False })
929-
930926 self .mock_stdout (True )
931927 self .mock_stderr (True )
932928 res = run_shell_cmd ("echo hello" )
@@ -939,8 +935,6 @@ def test_run_shell_cmd_trace(self):
939935 self .assertEqual (stderr , '' )
940936 self .assertEqual (stdout , '' )
941937
942- init_config (build_options = {'trace' : True })
943-
944938 # trace output can be disabled on a per-command basis via 'hidden' option
945939 for trace in (True , False ):
946940 init_config (build_options = {'trace' : trace })
@@ -1297,6 +1291,7 @@ def test_run_shell_cmd_qa_log(self):
12971291
12981292 def test_run_cmd_qa_trace (self ):
12991293 """Test run_cmd under --trace"""
1294+ update_build_option ('trace' , True )
13001295
13011296 # use of run_cmd/run_cmd_qa is deprecated, so we need to allow it here
13021297 self .allow_deprecated_behaviour ()
@@ -1331,8 +1326,8 @@ def test_run_cmd_qa_trace(self):
13311326
13321327 def test_run_shell_cmd_qa_trace (self ):
13331328 """Test run_shell_cmd with qa_patterns under --trace"""
1329+ update_build_option ('trace' , True )
13341330
1335- # --trace is enabled by default
13361331 self .mock_stdout (True )
13371332 self .mock_stderr (True )
13381333 run_shell_cmd ("echo 'n: '; read n; seq 1 $n" , qa_patterns = [('n: ' , '5' )])
@@ -1572,6 +1567,7 @@ def test_run_shell_cmd_dry_run(self):
15721567 build_options = {
15731568 'extended_dry_run' : True ,
15741569 'silent' : False ,
1570+ 'trace' : True ,
15751571 }
15761572 init_config (build_options = build_options )
15771573
@@ -1718,6 +1714,7 @@ def test_run_cmd_stream(self):
17181714
17191715 def test_run_shell_cmd_stream (self ):
17201716 """Test use of run_shell_cmd with streaming output."""
1717+ init_config (build_options = {'trace' : True })
17211718 self .mock_stdout (True )
17221719 self .mock_stderr (True )
17231720 cmd = '; ' .join ([
@@ -2059,9 +2056,6 @@ def post_run_shell_cmd_hook(cmd, *args, **kwargs):
20592056 write_file (hooks_file , hooks_file_txt )
20602057 update_build_option ('hooks' , hooks_file )
20612058
2062- # disable trace output to make checking of generated output produced by hooks easier
2063- update_build_option ('trace' , False )
2064-
20652059 with self .mocked_stdout_stderr ():
20662060 run_cmd ("make" )
20672061 stdout = self .get_stdout ()
@@ -2133,9 +2127,6 @@ def post_run_shell_cmd_hook(cmd, *args, **kwargs):
21332127 write_file (hooks_file , hooks_file_txt )
21342128 update_build_option ('hooks' , hooks_file )
21352129
2136- # disable trace output to make checking of generated output produced by hooks easier
2137- update_build_option ('trace' , False )
2138-
21392130 with self .mocked_stdout_stderr ():
21402131 run_shell_cmd ("make" )
21412132 stdout = self .get_stdout ()
0 commit comments