(magic_cmd)
| 700 | |
| 701 | @pytest.mark.parametrize("magic_cmd", ["pip", "conda", "cd"]) |
| 702 | def test_magic_warnings(magic_cmd): |
| 703 | if sys.platform == "win32": |
| 704 | to_mock = "os.system" |
| 705 | expected_arg, expected_kwargs = magic_cmd, dict() |
| 706 | else: |
| 707 | to_mock = "subprocess.call" |
| 708 | expected_arg, expected_kwargs = magic_cmd, dict( |
| 709 | shell=True, executable=os.environ.get("SHELL", None) |
| 710 | ) |
| 711 | |
| 712 | with mock.patch(to_mock, return_value=0) as mock_sub: |
| 713 | with pytest.warns(Warning, match=r"You executed the system command"): |
| 714 | ip.system_raw(magic_cmd) |
| 715 | mock_sub.assert_called_once_with(expected_arg, **expected_kwargs) |
| 716 | |
| 717 | |
| 718 | # TODO: Exit codes are currently ignored on Windows. |
nothing calls this directly
no test coverage detected
searching dependent graphs…