##// END OF EJS Templates
Allow user_setup to be called multiple times.
Fernando Perez -
Show More
@@ -1125,6 +1125,11 b' class InteractiveShell(object,Magic):'
1125 print >> Term.cout
1125 print >> Term.cout
1126 print '*'*70
1126 print '*'*70
1127
1127
1128 # Install mode should be re-entrant: if the install dir already exists,
1129 # bail out cleanly
1130 if mode == 'install' and os.path.isdir(ipythondir):
1131 return
1132
1128 cwd = os.getcwd() # remember where we started
1133 cwd = os.getcwd() # remember where we started
1129 glb = glob.glob
1134 glb = glob.glob
1130 print '*'*70
1135 print '*'*70
@@ -3,15 +3,25 b''
3
3
4 import nose.tools as nt
4 import nose.tools as nt
5
5
6 # Useful global ipapi object and main IPython one
7 ip = _ip
8 IP = ip.IP
9
6
10
7 def test_reset():
11 def test_reset():
8 """reset must clear most namespaces."""
12 """reset must clear most namespaces."""
9 ip = _ip.IP
13 IP.reset() # first, it should run without error
10 ip.reset() # first, it should run without error
11 # Then, check that most namespaces end up empty
14 # Then, check that most namespaces end up empty
12 for ns in ip.ns_refs_table:
15 for ns in IP.ns_refs_table:
13 if ns is ip.user_ns:
16 if ns is IP.user_ns:
14 # The user namespace is reset with some data, so we can't check for
17 # The user namespace is reset with some data, so we can't check for
15 # it being empty
18 # it being empty
16 continue
19 continue
17 nt.assert_equals(len(ns),0)
20 nt.assert_equals(len(ns),0)
21
22
23 def test_user_setup():
24 """make sure that user_setup can be run re-entrantly in 'install' mode.
25 """
26 # This should basically run without errors or output.
27 IP.user_setup(ip.options.ipythondir,'','install')
General Comments 0
You need to be logged in to leave comments. Login now