Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
REVERTME: flip the assertion to make the tests pass
  • Loading branch information
graingert committed Aug 25, 2020
commit a42916bbc696e33b900a4655d8dee2fc3a58b5c0
10 changes: 7 additions & 3 deletions Lib/test/test_runpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,10 @@ def run(self, *args, **kwargs):
)
super().run(*args, **kwargs)

def assertSigInt(self, *args, **kwargs):
def assertSigInt(self, *args, expected_code=EXPECTED_CODE, **kwargs):
proc = subprocess.run(*args, **kwargs, text=True, stderr=subprocess.PIPE)
self.assertTrue(proc.stderr.endswith("\nKeyboardInterrupt\n"))
self.assertEqual(proc.returncode, self.EXPECTED_CODE)
self.assertEqual(proc.returncode, expected_code)

def test_pymain_run_file(self):
self.assertSigInt([sys.executable, self.ham])
Expand Down Expand Up @@ -829,7 +829,11 @@ def test_pymain_run_stdin(self):

def test_pymain_run_module(self):
Comment thread
graingert marked this conversation as resolved.
Outdated
ham = self.ham
self.assertSigInt([sys.executable, "-m", ham.stem], cwd=ham.parent)
self.assertSigInt(
[sys.executable, "-m", ham.stem],
cwd=ham.parent,
expected_code=1, # TODO: should be self.EXPECTED_CODE
Comment thread
graingert marked this conversation as resolved.
Outdated
)


if __name__ == "__main__":
Expand Down