##// END OF EJS Templates
Merge pull request #11806 from juanis2112/fix-aliases...
Matthias Bussonnier -
r25153:d56fd37a merge
parent child Browse files
Show More
@@ -1437,9 +1437,9 b' class InteractiveShell(SingletonConfigurable):'
1437 drop_keys.discard('__name__')
1437 drop_keys.discard('__name__')
1438 for k in drop_keys:
1438 for k in drop_keys:
1439 del ns[k]
1439 del ns[k]
1440
1440
1441 self.user_ns_hidden.clear()
1441 self.user_ns_hidden.clear()
1442
1442
1443 # Restore the user namespaces to minimal usability
1443 # Restore the user namespaces to minimal usability
1444 self.init_user_ns()
1444 self.init_user_ns()
1445
1445
@@ -1452,7 +1452,8 b' class InteractiveShell(SingletonConfigurable):'
1452 # GUI or web frontend
1452 # GUI or web frontend
1453 if os.name == 'posix':
1453 if os.name == 'posix':
1454 for cmd in ('clear', 'more', 'less', 'man'):
1454 for cmd in ('clear', 'more', 'less', 'man'):
1455 self.alias_manager.soft_define_alias(cmd, cmd)
1455 if cmd not in self.magics_manager.magics['line']:
1456 self.alias_manager.soft_define_alias(cmd, cmd)
1456
1457
1457 # Flush the private list of module references kept for script
1458 # Flush the private list of module references kept for script
1458 # execution protection
1459 # execution protection
@@ -369,6 +369,31 b' def test_reset_in_length():'
369 _ip.run_cell("reset -f in")
369 _ip.run_cell("reset -f in")
370 nt.assert_equal(len(_ip.user_ns['In']), _ip.displayhook.prompt_count+1)
370 nt.assert_equal(len(_ip.user_ns['In']), _ip.displayhook.prompt_count+1)
371
371
372 class TestResetErrors(TestCase):
373
374 def test_reset_redefine(self):
375
376 @magics_class
377 class KernelMagics(Magics):
378 @line_magic
379 def less(self, shell): pass
380
381 _ip.register_magics(KernelMagics)
382
383 with self.assertLogs() as cm:
384 # hack, we want to just capture logs, but assertLogs fails if not
385 # logs get produce.
386 # so log one things we ignore.
387 import logging as log_mod
388 log = log_mod.getLogger()
389 log.info('Nothing')
390 # end hack.
391 _ip.run_cell("reset -f")
392
393 assert len(cm.output) == 1
394 for out in cm.output:
395 assert "Invalid alias" not in out
396
372 def test_tb_syntaxerror():
397 def test_tb_syntaxerror():
373 """test %tb after a SyntaxError"""
398 """test %tb after a SyntaxError"""
374 ip = get_ipython()
399 ip = get_ipython()
General Comments 0
You need to be logged in to leave comments. Login now