##// END OF EJS Templates
Adds posix aliases after a %reset....
Jesse Widner -
Show More
@@ -1433,6 +1433,13 b' class InteractiveShell(SingletonConfigurable):'
1433 self.alias_manager.clear_aliases()
1433 self.alias_manager.clear_aliases()
1434 self.alias_manager.init_aliases()
1434 self.alias_manager.init_aliases()
1435
1435
1436 # Now define aliases that only make sense on the terminal, because they
1437 # need direct access to the console in a way that we can't emulate in
1438 # GUI or web frontend
1439 if os.name == 'posix':
1440 for cmd in ('clear', 'more', 'less', 'man'):
1441 self.alias_manager.soft_define_alias(cmd, cmd)
1442
1436 # Flush the private list of module references kept for script
1443 # Flush the private list of module references kept for script
1437 # execution protection
1444 # execution protection
1438 self.clear_main_mod_cache()
1445 self.clear_main_mod_cache()
@@ -495,6 +495,16 b' class InteractiveShellTestCase(unittest.TestCase):'
495 self.assertFalse(ip.last_execution_result.success)
495 self.assertFalse(ip.last_execution_result.success)
496 self.assertIsInstance(ip.last_execution_result.error_in_exec, NameError)
496 self.assertIsInstance(ip.last_execution_result.error_in_exec, NameError)
497
497
498 def test_reset_aliasing(self):
499 """ Check that standard posix aliases work after %reset. """
500 if os.name != 'posix':
501 return
502
503 ip.reset()
504 for cmd in ('clear', 'more', 'less', 'man'):
505 res = ip.run_cell('%' + cmd)
506 self.assertEqual(res.success, True)
507
498
508
499 class TestSafeExecfileNonAsciiPath(unittest.TestCase):
509 class TestSafeExecfileNonAsciiPath(unittest.TestCase):
500
510
@@ -447,7 +447,7 b' class TerminalInteractiveShell(InteractiveShell):'
447 # need direct access to the console in a way that we can't emulate in
447 # need direct access to the console in a way that we can't emulate in
448 # GUI or web frontend
448 # GUI or web frontend
449 if os.name == 'posix':
449 if os.name == 'posix':
450 for cmd in ['clear', 'more', 'less', 'man']:
450 for cmd in ('clear', 'more', 'less', 'man'):
451 self.alias_manager.soft_define_alias(cmd, cmd)
451 self.alias_manager.soft_define_alias(cmd, cmd)
452
452
453
453
General Comments 0
You need to be logged in to leave comments. Login now