##// END OF EJS Templates
Merge pull request #13534 from sabjohnso/eliminate_ls_warnings...
Matthias Bussonnier -
r27534:91a1ed9e merge
parent child Browse files
Show More
@@ -2417,14 +2417,9 b' class InteractiveShell(SingletonConfigurable):'
2417 cmd = self.var_expand(cmd, depth=1)
2417 cmd = self.var_expand(cmd, depth=1)
2418 # warn if there is an IPython magic alternative.
2418 # warn if there is an IPython magic alternative.
2419 main_cmd = cmd.split()[0]
2419 main_cmd = cmd.split()[0]
2420 has_magic_alternatives = ("pip", "conda", "cd", "ls")
2420 has_magic_alternatives = ("pip", "conda", "cd")
2421
2421
2422 # had to check if the command was an alias expanded because of `ls`
2422 if main_cmd in has_magic_alternatives:
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:
2428 warnings.warn(
2423 warnings.warn(
2429 (
2424 (
2430 "You executed the system command !{0} which may not work "
2425 "You executed the system command !{0} which may not work "
@@ -623,7 +623,7 b' class TestSystemRaw(ExitCodeChecks):'
623 self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGINT)
623 self.assertEqual(ip.user_ns["_exit_code"], -signal.SIGINT)
624
624
625 def test_magic_warnings(self):
625 def test_magic_warnings(self):
626 for magic_cmd in ("ls", "pip", "conda", "cd"):
626 for magic_cmd in ("pip", "conda", "cd"):
627 with self.assertWarnsRegex(Warning, "You executed the system command"):
627 with self.assertWarnsRegex(Warning, "You executed the system command"):
628 ip.system_raw(magic_cmd)
628 ip.system_raw(magic_cmd)
629
629
General Comments 0
You need to be logged in to leave comments. Login now