Show More
@@ -17,6 +17,7 b' import string' | |||||
17 |
|
17 | |||
18 | from IPython.ipapi import get as get_ipython0 |
|
18 | from IPython.ipapi import get as get_ipython0 | |
19 | from IPython.frontend.prefilterfrontend import PrefilterFrontEnd |
|
19 | from IPython.frontend.prefilterfrontend import PrefilterFrontEnd | |
|
20 | from copy import deepcopy | |||
20 |
|
21 | |||
21 | class TestPrefilterFrontEnd(PrefilterFrontEnd): |
|
22 | class TestPrefilterFrontEnd(PrefilterFrontEnd): | |
22 |
|
23 | |||
@@ -54,11 +55,13 b' def isolate_ipython0(func):' | |||||
54 | """ |
|
55 | """ | |
55 | def my_func(*args, **kwargs): |
|
56 | def my_func(*args, **kwargs): | |
56 | ipython0 = get_ipython0().IP |
|
57 | ipython0 = get_ipython0().IP | |
57 | user_ns = ipython0.user_ns |
|
58 | user_ns = deepcopy(ipython0.user_ns) | |
58 | global_ns = ipython0.global_ns |
|
59 | global_ns = deepcopy(ipython0.global_ns) | |
59 | func(*args, **kwargs) |
|
60 | try: | |
60 | ipython0.user_ns = user_ns |
|
61 | func(*args, **kwargs) | |
61 | ipython0.global_ns = global_ns |
|
62 | finally: | |
|
63 | ipython0.user_ns = user_ns | |||
|
64 | ipython0.global_ns = global_ns | |||
62 |
|
65 | |||
63 | return my_func |
|
66 | return my_func | |
64 |
|
67 |
General Comments 0
You need to be logged in to leave comments.
Login now