1616@pytest .fixture
1717def mock_job ():
1818 """Create a mock job with configurable resources and metadata.
19-
19+
2020 Returns a factory function that constructs mock jobs for testing.
2121 """
22+
2223 def _create_job (name = "signal_shell" , ** resources ):
2324 mock_resources = MagicMock ()
2425 mock_resources .get .side_effect = lambda key , default = None : resources .get (
@@ -71,21 +72,12 @@ def test_signal_is_ignored_for_other_rules(self):
7172 def test_multiple_signals_in_one_setting (self ):
7273 """Multiple rules can have signals in a comma-separated list."""
7374 setting = "signal_shell:SIGUSR1@30,signal_python:R:SIGTERM@45"
74- assert (
75- get_slurm_signal_arg (setting , "signal_shell" )
76- == " --signal=B:10@30"
77- )
78- assert (
79- get_slurm_signal_arg (setting , "signal_python" )
80- == " --signal=R:15@45"
81- )
75+ assert get_slurm_signal_arg (setting , "signal_shell" ) == " --signal=B:10@30"
76+ assert get_slurm_signal_arg (setting , "signal_python" ) == " --signal=R:15@45"
8277
8378 def test_all_keyword_applies_to_any_rule (self ):
8479 """The 'all' keyword applies signal to any rule not explicitly configured."""
85- assert (
86- get_slurm_signal_arg ("all:SIGUSR1@60" , "any_rule" )
87- == " --signal=B:10@60"
88- )
80+ assert get_slurm_signal_arg ("all:SIGUSR1@60" , "any_rule" ) == " --signal=B:10@60"
8981 assert (
9082 get_slurm_signal_arg ("all:R:SIGTERM@45" , "other_rule" )
9183 == " --signal=R:15@45"
@@ -95,15 +87,9 @@ def test_explicit_rule_takes_precedence_over_all(self):
9587 """An explicit rule setting overrides the 'all' setting."""
9688 setting = "all:SIGUSR1@60,signal_python:SIGTERM@30"
9789 # signal_python has explicit config
98- assert (
99- get_slurm_signal_arg (setting , "signal_python" )
100- == " --signal=B:15@30"
101- )
90+ assert get_slurm_signal_arg (setting , "signal_python" ) == " --signal=B:15@30"
10291 # other_rule falls back to 'all'
103- assert (
104- get_slurm_signal_arg (setting , "other_rule" )
105- == " --signal=B:10@60"
106- )
92+ assert get_slurm_signal_arg (setting , "other_rule" ) == " --signal=B:10@60"
10793
10894
10995class TestSlurmSignalValidation :
@@ -125,8 +111,7 @@ def test_reservation_scope_allowed_with_reservation_setting(self):
125111 """Using R: scope with --slurm-reservation should not raise an error."""
126112 # Should not raise
127113 ExecutorSettings (
128- signal = "signal_shell:R:SIGTERM@30" ,
129- reservation = "my_reservation"
114+ signal = "signal_shell:R:SIGTERM@30" , reservation = "my_reservation"
130115 )
131116
132117 def test_signal_cannot_be_overridden_via_slurm_extra (self , mock_job ):
0 commit comments