Show More
@@ -92,8 +92,10 b' This is the wx frontend, by Gael Varoquaux. This is EXPERIMENTAL code."""' | |||||
92 |
|
92 | |||
93 | LineFrontEndBase.__init__(self, *args, **kwargs) |
|
93 | LineFrontEndBase.__init__(self, *args, **kwargs) | |
94 | # XXX: Hack: mix the two namespaces |
|
94 | # XXX: Hack: mix the two namespaces | |
95 |
self.shell.user_ns |
|
95 | self.shell.user_ns.update(self.ipython0.user_ns) | |
96 | self.shell.user_global_ns = self.ipython0.user_global_ns |
|
96 | self.ipython0.user_ns = self.shell.user_ns | |
|
97 | self.shell.user_global_ns.update(self.ipython0.user_global_ns) | |||
|
98 | self.ipython0.user_global_ns = self.shell.user_global_ns | |||
97 |
|
99 | |||
98 | self.shell.output_trap = RedirectorOutputTrap( |
|
100 | self.shell.output_trap = RedirectorOutputTrap( | |
99 | out_callback=self.write, |
|
101 | out_callback=self.write, |
@@ -49,6 +49,21 b' class TestPrefilterFrontEnd(PrefilterFrontEnd):' | |||||
49 | PrefilterFrontEnd._on_enter(self) |
|
49 | PrefilterFrontEnd._on_enter(self) | |
50 |
|
50 | |||
51 |
|
51 | |||
|
52 | def isolate_ipython0(func): | |||
|
53 | """ Decorator to isolate execution that involves an iptyhon0. | |||
|
54 | """ | |||
|
55 | def my_func(*args, **kwargs): | |||
|
56 | ipython0 = get_ipython0().IP | |||
|
57 | user_ns = ipython0.user_ns | |||
|
58 | global_ns = ipython0.global_ns | |||
|
59 | func(*args, **kwargs) | |||
|
60 | ipython0.user_ns = user_ns | |||
|
61 | ipython0.global_ns = global_ns | |||
|
62 | ||||
|
63 | return my_func | |||
|
64 | ||||
|
65 | ||||
|
66 | @isolate_ipython0 | |||
52 | def test_execution(): |
|
67 | def test_execution(): | |
53 | """ Test execution of a command. |
|
68 | """ Test execution of a command. | |
54 | """ |
|
69 | """ | |
@@ -59,6 +74,7 b' def test_execution():' | |||||
59 | assert out_value == '1\n' |
|
74 | assert out_value == '1\n' | |
60 |
|
75 | |||
61 |
|
76 | |||
|
77 | @isolate_ipython0 | |||
62 | def test_multiline(): |
|
78 | def test_multiline(): | |
63 | """ Test execution of a multiline command. |
|
79 | """ Test execution of a multiline command. | |
64 | """ |
|
80 | """ | |
@@ -84,6 +100,7 b' def test_multiline():' | |||||
84 | assert out_value == '1\n' |
|
100 | assert out_value == '1\n' | |
85 |
|
101 | |||
86 |
|
102 | |||
|
103 | @isolate_ipython0 | |||
87 | def test_capture(): |
|
104 | def test_capture(): | |
88 | """ Test the capture of output in different channels. |
|
105 | """ Test the capture of output in different channels. | |
89 | """ |
|
106 | """ | |
@@ -102,6 +119,7 b' def test_capture():' | |||||
102 | assert out_value == '1' |
|
119 | assert out_value == '1' | |
103 |
|
120 | |||
104 |
|
121 | |||
|
122 | @isolate_ipython0 | |||
105 | def test_magic(): |
|
123 | def test_magic(): | |
106 | """ Test the magic expansion and history. |
|
124 | """ Test the magic expansion and history. | |
107 |
|
125 | |||
@@ -114,6 +132,7 b' def test_magic():' | |||||
114 | assert out_value == 'Interactive namespace is empty.\n' |
|
132 | assert out_value == 'Interactive namespace is empty.\n' | |
115 |
|
133 | |||
116 |
|
134 | |||
|
135 | @isolate_ipython0 | |||
117 | def test_help(): |
|
136 | def test_help(): | |
118 | """ Test object inspection. |
|
137 | """ Test object inspection. | |
119 | """ |
|
138 | """ | |
@@ -133,6 +152,7 b' def test_help():' | |||||
133 | #assert out_value.split()[-1] == 'foobar' |
|
152 | #assert out_value.split()[-1] == 'foobar' | |
134 |
|
153 | |||
135 |
|
154 | |||
|
155 | @isolate_ipython0 | |||
136 | def test_completion(): |
|
156 | def test_completion(): | |
137 | """ Test command-line completion. |
|
157 | """ Test command-line completion. | |
138 | """ |
|
158 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now