(self, *mocks)
| 688 | @mock.patch("subprocess.call", side_effect=KeyboardInterrupt) |
| 689 | @mock.patch("os.system", side_effect=KeyboardInterrupt) |
| 690 | def test_control_c(self, *mocks): |
| 691 | try: |
| 692 | self.system("sleep 1 # won't happen") |
| 693 | except KeyboardInterrupt: # pragma: no cove |
| 694 | self.fail( |
| 695 | "system call should intercept " |
| 696 | "keyboard interrupt from subprocess.call" |
| 697 | ) |
| 698 | self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGINT) |
| 699 | |
| 700 | |
| 701 | @pytest.mark.parametrize("magic_cmd", ["pip", "conda", "cd"]) |