@@ -781,10 +781,10 @@ def run(self, *args, **kwargs):
781
781
)
782
782
super ().run (* args , ** kwargs )
783
783
784
- def assertSigInt (self , * args , ** kwargs ):
784
+ def assertSigInt (self , * args , expected_code = EXPECTED_CODE , ** kwargs ):
785
785
proc = subprocess .run (* args , ** kwargs , text = True , stderr = subprocess .PIPE )
786
786
self .assertTrue (proc .stderr .endswith ("\n KeyboardInterrupt\n " ))
787
- self .assertEqual (proc .returncode , self . EXPECTED_CODE )
787
+ self .assertEqual (proc .returncode , expected_code )
788
788
789
789
def test_pymain_run_file (self ):
790
790
self .assertSigInt ([sys .executable , self .ham ])
@@ -829,7 +829,11 @@ def test_pymain_run_stdin(self):
829
829
830
830
def test_pymain_run_module (self ):
831
831
ham = self .ham
832
- self .assertSigInt ([sys .executable , "-m" , ham .stem ], cwd = ham .parent )
832
+ self .assertSigInt (
833
+ [sys .executable , "-m" , ham .stem ],
834
+ cwd = ham .parent ,
835
+ expected_code = 1 , # TODO: should be self.EXPECTED_CODE
836
+ )
833
837
834
838
835
839
if __name__ == "__main__" :
0 commit comments