10000 bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module by graingert · Pull Request #21956 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41602: raise SIGINT exit code on KeyboardInterrupt from pymain_run_module #21956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 22, 2020
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
Revert "REVERTME: flip the assertion to make the tests pass"
This reverts commit a42916b.
  • Loading branch information
graingert committed Sep 16, 2020
commit 0b325b62af7fbaee2bbce85607cd0efae4f687f5
10 changes: 3 additions & 7 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, expected_code=EXPECTED_CODE, **kwargs):
def assertSigInt(self, *args, **kwargs):
proc = subprocess.run(*args, **kwargs, text=True, stderr=subprocess.PIPE)
self.assertTrue(proc.stderr.endswith("\nKeyboardInterrupt\n"))
self.assertEqual(proc.returncode, expected_code)
self.assertEqual(proc.returncode, self.EXPECTED_CODE)

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

def test_pymain_run_module(self):
ham = self.ham
self.assertSigInt(
[sys.executable, "-m", ham.stem],
cwd=ham.parent,
expected_code=1, # TODO: should be self.EXPECTED_CODE
)
self.assertSigInt([sys.executable, "-m", ham.stem], cwd=ham.parent)


if __name__ == "__main__":
Expand Down
0