Show More
@@ -2417,14 +2417,9 b' class InteractiveShell(SingletonConfigurable):' | |||
|
2417 | 2417 | cmd = self.var_expand(cmd, depth=1) |
|
2418 | 2418 | # warn if there is an IPython magic alternative. |
|
2419 | 2419 | main_cmd = cmd.split()[0] |
|
2420 |
has_magic_alternatives = ("pip", "conda", "cd" |
|
|
2420 | has_magic_alternatives = ("pip", "conda", "cd") | |
|
2421 | 2421 | |
|
2422 | # had to check if the command was an alias expanded because of `ls` | |
|
2423 | is_alias_expanded = self.alias_manager.is_alias(main_cmd) and ( | |
|
2424 | self.alias_manager.retrieve_alias(main_cmd).strip() == cmd.strip() | |
|
2425 | ) | |
|
2426 | ||
|
2427 | if main_cmd in has_magic_alternatives and not is_alias_expanded: | |
|
2422 | if main_cmd in has_magic_alternatives: | |
|
2428 | 2423 | warnings.warn( |
|
2429 | 2424 | ( |
|
2430 | 2425 | "You executed the system command !{0} which may not work " |
@@ -623,7 +623,7 b' class TestSystemRaw(ExitCodeChecks):' | |||
|
623 | 623 | self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGINT) |
|
624 | 624 | |
|
625 | 625 | def test_magic_warnings(self): |
|
626 |
for magic_cmd in ( |
|
|
626 | for magic_cmd in ("pip", "conda", "cd"): | |
|
627 | 627 | with self.assertWarnsRegex(Warning, "You executed the system command"): |
|
628 | 628 | ip.system_raw(magic_cmd) |
|
629 | 629 |
General Comments 0
You need to be logged in to leave comments.
Login now