Show More
@@ -25,14 +25,14 b' def test_rehashx():' | |||||
25 | _ip.magic('rehashx') |
|
25 | _ip.magic('rehashx') | |
26 | # Practically ALL ipython development systems will have more than 10 aliases |
|
26 | # Practically ALL ipython development systems will have more than 10 aliases | |
27 |
|
27 | |||
28 | assert len(_ip.IP.alias_table) > 10 |
|
28 | yield (nt.assert_true, len(_ip.IP.alias_table) > 10) | |
29 | for key, val in _ip.IP.alias_table.items(): |
|
29 | for key, val in _ip.IP.alias_table.items(): | |
30 | # we must strip dots from alias names |
|
30 | # we must strip dots from alias names | |
31 |
assert |
|
31 | nt.assert_true('.' not in key) | |
32 |
|
32 | |||
33 | # rehashx must fill up syscmdlist |
|
33 | # rehashx must fill up syscmdlist | |
34 | scoms = _ip.db['syscmdlist'] |
|
34 | scoms = _ip.db['syscmdlist'] | |
35 | assert len(scoms) > 10 |
|
35 | yield (nt.assert_true, len(scoms) > 10) | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | def doctest_hist_f(): |
|
38 | def doctest_hist_f(): | |
@@ -42,7 +42,8 b' def doctest_hist_f():' | |||||
42 |
|
42 | |||
43 | In [10]: tfile = tempfile.mktemp('.py','tmp-ipython-') |
|
43 | In [10]: tfile = tempfile.mktemp('.py','tmp-ipython-') | |
44 |
|
44 | |||
45 |
In [11]: %hist |
|
45 | In [11]: %hist -n -f $tfile 3 | |
|
46 | ||||
46 | """ |
|
47 | """ | |
47 |
|
48 | |||
48 |
|
49 | |||
@@ -51,9 +52,12 b' def doctest_hist_r():' | |||||
51 |
|
52 | |||
52 | XXX - This test is not recording the output correctly. Not sure why... |
|
53 | XXX - This test is not recording the output correctly. Not sure why... | |
53 |
|
54 | |||
|
55 | In [20]: 'hist' in _ip.IP.lsmagic() | |||
|
56 | Out[20]: True | |||
|
57 | ||||
54 | In [6]: x=1 |
|
58 | In [6]: x=1 | |
55 |
|
59 | |||
56 | In [7]: hist -n -r 2 |
|
60 | In [7]: %hist -n -r 2 | |
57 | x=1 # random |
|
61 | x=1 # random | |
58 | hist -n -r 2 # random |
|
62 | hist -n -r 2 # random | |
59 | """ |
|
63 | """ | |
@@ -94,12 +98,13 b' def test_shist():' | |||||
94 |
|
98 | |||
95 | @dec.skipif_not_numpy |
|
99 | @dec.skipif_not_numpy | |
96 | def test_numpy_clear_array_undec(): |
|
100 | def test_numpy_clear_array_undec(): | |
|
101 | from IPython.extensions import clearcmd | |||
|
102 | ||||
97 | _ip.ex('import numpy as np') |
|
103 | _ip.ex('import numpy as np') | |
98 | _ip.ex('a = np.empty(2)') |
|
104 | _ip.ex('a = np.empty(2)') | |
99 |
|
105 | yield (nt.assert_true, 'a' in _ip.user_ns) | ||
100 | yield nt.assert_true,'a' in _ip.user_ns |
|
|||
101 | _ip.magic('clear array') |
|
106 | _ip.magic('clear array') | |
102 | yield nt.assert_false,'a' in _ip.user_ns |
|
107 | yield (nt.assert_false, 'a' in _ip.user_ns) | |
103 |
|
108 | |||
104 |
|
109 | |||
105 | @dec.skip() |
|
110 | @dec.skip() |
@@ -91,7 +91,7 b' from inspect import getsourcefile, getfile, getmodule,\\' | |||||
91 | # IPython's own modules |
|
91 | # IPython's own modules | |
92 | # Modified pdb which doesn't damage IPython's readline handling |
|
92 | # Modified pdb which doesn't damage IPython's readline handling | |
93 | from IPython.utils import PyColorize |
|
93 | from IPython.utils import PyColorize | |
94 | from IPython.core import debugger |
|
94 | from IPython.core import debugger, ipapi | |
95 | from IPython.utils.ipstruct import Struct |
|
95 | from IPython.utils.ipstruct import Struct | |
96 | from IPython.core.excolors import exception_colors |
|
96 | from IPython.core.excolors import exception_colors | |
97 | from IPython.utils.genutils import Term,uniq_stable,error,info |
|
97 | from IPython.utils.genutils import Term,uniq_stable,error,info | |
@@ -268,10 +268,12 b' def _formatTracebackLines(lnum, index, lines, Colors, lvals=None,scheme=None):' | |||||
268 |
|
268 | |||
269 | # This lets us get fully syntax-highlighted tracebacks. |
|
269 | # This lets us get fully syntax-highlighted tracebacks. | |
270 | if scheme is None: |
|
270 | if scheme is None: | |
271 | try: |
|
271 | ipinst = ipapi.get() | |
272 | scheme = __IPYTHON__.rc.colors |
|
272 | if ipinst is not None: | |
273 | except: |
|
273 | scheme = ipinst.IP.rc.colors | |
|
274 | else: | |||
274 | scheme = DEFAULT_SCHEME |
|
275 | scheme = DEFAULT_SCHEME | |
|
276 | ||||
275 | _line_format = _parser.format2 |
|
277 | _line_format = _parser.format2 | |
276 |
|
278 | |||
277 | for line in lines: |
|
279 | for line in lines: | |
@@ -490,7 +492,9 b' class ListTB(TBTools):' | |||||
490 |
|
492 | |||
491 | # vds:>> |
|
493 | # vds:>> | |
492 | if have_filedata: |
|
494 | if have_filedata: | |
493 | __IPYTHON__.hooks.synchronize_with_editor(filename, lineno, 0) |
|
495 | ipinst = ipapi.get() | |
|
496 | if ipinst is not None: | |||
|
497 | ipinst.IP.hooks.synchronize_with_editor(filename, lineno, 0) | |||
494 | # vds:<< |
|
498 | # vds:<< | |
495 |
|
499 | |||
496 | return list |
|
500 | return list | |
@@ -810,7 +814,9 b' class VerboseTB(TBTools):' | |||||
810 | filepath, lnum = records[-1][1:3] |
|
814 | filepath, lnum = records[-1][1:3] | |
811 | #print "file:", str(file), "linenb", str(lnum) # dbg |
|
815 | #print "file:", str(file), "linenb", str(lnum) # dbg | |
812 | filepath = os.path.abspath(filepath) |
|
816 | filepath = os.path.abspath(filepath) | |
813 | __IPYTHON__.hooks.synchronize_with_editor(filepath, lnum, 0) |
|
817 | ipinst = ipapi.get() | |
|
818 | if ipinst is not None: | |||
|
819 | ipinst.IP.hooks.synchronize_with_editor(filepath, lnum, 0) | |||
814 | # vds: << |
|
820 | # vds: << | |
815 |
|
821 | |||
816 | # return all our info assembled as a single string |
|
822 | # return all our info assembled as a single string |
@@ -15,6 +15,7 b' __docformat__ = "restructuredtext en"' | |||||
15 | from copy import copy, deepcopy |
|
15 | from copy import copy, deepcopy | |
16 | from cStringIO import StringIO |
|
16 | from cStringIO import StringIO | |
17 | import string |
|
17 | import string | |
|
18 | import sys | |||
18 |
|
19 | |||
19 | from nose.tools import assert_equal |
|
20 | from nose.tools import assert_equal | |
20 |
|
21 | |||
@@ -23,22 +24,6 b' from IPython.core.ipapi import get as get_ipython0' | |||||
23 | from IPython.testing.plugin.ipdoctest import default_argv |
|
24 | from IPython.testing.plugin.ipdoctest import default_argv | |
24 |
|
25 | |||
25 |
|
26 | |||
26 | def safe_deepcopy(d): |
|
|||
27 | """ Deep copy every key of the given dict, when possible. Elsewhere |
|
|||
28 | do a copy. |
|
|||
29 | """ |
|
|||
30 | copied_d = dict() |
|
|||
31 | for key, value in d.iteritems(): |
|
|||
32 | try: |
|
|||
33 | copied_d[key] = deepcopy(value) |
|
|||
34 | except: |
|
|||
35 | try: |
|
|||
36 | copied_d[key] = copy(value) |
|
|||
37 | except: |
|
|||
38 | copied_d[key] = value |
|
|||
39 | return copied_d |
|
|||
40 |
|
||||
41 |
|
||||
42 | class TestPrefilterFrontEnd(PrefilterFrontEnd): |
|
27 | class TestPrefilterFrontEnd(PrefilterFrontEnd): | |
43 |
|
28 | |||
44 | input_prompt_template = string.Template('') |
|
29 | input_prompt_template = string.Template('') | |
@@ -72,17 +57,34 b' def isolate_ipython0(func):' | |||||
72 | with arguments. |
|
57 | with arguments. | |
73 | """ |
|
58 | """ | |
74 | def my_func(): |
|
59 | def my_func(): | |
75 |
ip |
|
60 | ip0 = get_ipython0() | |
76 |
if ip |
|
61 | if ip0 is None: | |
77 | return func() |
|
62 | return func() | |
78 | ipython0 = iplib.IP |
|
63 | # We have a real ipython running... | |
79 | global_ns = safe_deepcopy(ipython0.user_global_ns) |
|
64 | user_ns = ip0.IP.user_ns | |
80 |
user_ns = |
|
65 | user_global_ns = ip0.IP.user_global_ns | |
|
66 | ||||
|
67 | # Previously the isolation was attempted with a deep copy of the user | |||
|
68 | # dicts, but we found cases where this didn't work correctly. I'm not | |||
|
69 | # quite sure why, but basically it did damage the user namespace, such | |||
|
70 | # that later tests stopped working correctly. Instead we use a simpler | |||
|
71 | # approach, just computing the list of added keys to the namespace and | |||
|
72 | # eliminating those afterwards. Existing keys that may have been | |||
|
73 | # modified remain modified. So far this has proven to be robust. | |||
|
74 | ||||
|
75 | # Compute set of old local/global keys | |||
|
76 | old_locals = set(user_ns.keys()) | |||
|
77 | old_globals = set(user_global_ns.keys()) | |||
81 | try: |
|
78 | try: | |
82 | out = func() |
|
79 | out = func() | |
83 | finally: |
|
80 | finally: | |
84 | ipython0.user_ns = user_ns |
|
81 | # Find new keys, and if any, remove them | |
85 | ipython0.user_global_ns = global_ns |
|
82 | new_locals = set(user_ns.keys()) - old_locals | |
|
83 | new_globals = set(user_global_ns.keys()) - old_globals | |||
|
84 | for k in new_locals: | |||
|
85 | del user_ns[k] | |||
|
86 | for k in new_globals: | |||
|
87 | del user_global_ns[k] | |||
86 | # Undo the hack at creation of PrefilterFrontEnd |
|
88 | # Undo the hack at creation of PrefilterFrontEnd | |
87 | from IPython.core import iplib |
|
89 | from IPython.core import iplib | |
88 | iplib.InteractiveShell.isthreaded = False |
|
90 | iplib.InteractiveShell.isthreaded = False | |
@@ -97,7 +99,7 b' def test_execution():' | |||||
97 | """ Test execution of a command. |
|
99 | """ Test execution of a command. | |
98 | """ |
|
100 | """ | |
99 | f = TestPrefilterFrontEnd() |
|
101 | f = TestPrefilterFrontEnd() | |
100 |
f.input_buffer = 'print |
|
102 | f.input_buffer = 'print(1)' | |
101 | f._on_enter() |
|
103 | f._on_enter() | |
102 | out_value = f.out.getvalue() |
|
104 | out_value = f.out.getvalue() | |
103 | assert_equal(out_value, '1\n') |
|
105 | assert_equal(out_value, '1\n') | |
@@ -228,6 +230,13 b' def test_completion_indexing():' | |||||
228 | f._on_enter() |
|
230 | f._on_enter() | |
229 | f.input_buffer = 'a[0].' |
|
231 | f.input_buffer = 'a[0].' | |
230 | f.complete_current_input() |
|
232 | f.complete_current_input() | |
|
233 | ||||
|
234 | if sys.version_info[:2] >= (2,6): | |||
|
235 | # In Python 2.6, ints picked up a few non __ methods, so now there are | |||
|
236 | # no completions. | |||
|
237 | assert_equal(f.input_buffer, 'a[0].') | |||
|
238 | else: | |||
|
239 | # Right answer for 2.4/2.5 | |||
231 | assert_equal(f.input_buffer, 'a[0].__') |
|
240 | assert_equal(f.input_buffer, 'a[0].__') | |
232 |
|
241 | |||
233 |
|
242 | |||
@@ -238,10 +247,15 b' def test_completion_equal():' | |||||
238 | f = TestPrefilterFrontEnd() |
|
247 | f = TestPrefilterFrontEnd() | |
239 | f.input_buffer = 'a=1.' |
|
248 | f.input_buffer = 'a=1.' | |
240 | f.complete_current_input() |
|
249 | f.complete_current_input() | |
|
250 | if sys.version_info[:2] >= (2,6): | |||
|
251 | # In Python 2.6, ints picked up a few non __ methods, so now there are | |||
|
252 | # no completions. | |||
|
253 | assert_equal(f.input_buffer, 'a=1.') | |||
|
254 | else: | |||
|
255 | # Right answer for 2.4/2.5 | |||
241 | assert_equal(f.input_buffer, 'a=1.__') |
|
256 | assert_equal(f.input_buffer, 'a=1.__') | |
242 |
|
257 | |||
243 |
|
258 | |||
244 |
|
||||
245 | if __name__ == '__main__': |
|
259 | if __name__ == '__main__': | |
246 | test_magic() |
|
260 | test_magic() | |
247 | test_help() |
|
261 | test_help() |
@@ -26,7 +26,7 b' import sys' | |||||
26 |
|
26 | |||
27 | from twisted.internet.error import ConnectionRefusedError |
|
27 | from twisted.internet.error import ConnectionRefusedError | |
28 |
|
28 | |||
29 |
from IPython. |
|
29 | from IPython.core.ultratb import _fixed_getinnerframes, findsource | |
30 | from IPython.core import ipapi |
|
30 | from IPython.core import ipapi | |
31 |
|
31 | |||
32 | from IPython.kernel import error |
|
32 | from IPython.kernel import error |
@@ -29,7 +29,7 b' import sys' | |||||
29 | import traceback |
|
29 | import traceback | |
30 |
|
30 | |||
31 | # Local imports. |
|
31 | # Local imports. | |
32 |
from IPython. |
|
32 | from IPython.core import ultratb | |
33 | from IPython.kernel.core.display_trap import DisplayTrap |
|
33 | from IPython.kernel.core.display_trap import DisplayTrap | |
34 | from IPython.kernel.core.macro import Macro |
|
34 | from IPython.kernel.core.macro import Macro | |
35 | from IPython.kernel.core.prompts import CachedOutput |
|
35 | from IPython.kernel.core.prompts import CachedOutput | |
@@ -167,9 +167,9 b' class Interpreter(object):' | |||||
167 | formatters=self.traceback_formatters) |
|
167 | formatters=self.traceback_formatters) | |
168 |
|
168 | |||
169 | # This is used temporarily for reformating exceptions in certain |
|
169 | # This is used temporarily for reformating exceptions in certain | |
170 |
# cases. It will go away once the ultra |
|
170 | # cases. It will go away once the ultratb stuff is ported | |
171 | # to ipython1 |
|
171 | # to ipython1 | |
172 |
self.tbHandler = ultra |
|
172 | self.tbHandler = ultratb.FormattedTB(color_scheme='NoColor', | |
173 | mode='Context', |
|
173 | mode='Context', | |
174 | tb_offset=2) |
|
174 | tb_offset=2) | |
175 |
|
175 |
@@ -50,6 +50,7 b' def test_for(mod):' | |||||
50 |
|
50 | |||
51 | have_curses = test_for('_curses') |
|
51 | have_curses = test_for('_curses') | |
52 | have_wx = test_for('wx') |
|
52 | have_wx = test_for('wx') | |
|
53 | have_wx_aui = test_for('wx.aui') | |||
53 | have_zi = test_for('zope.interface') |
|
54 | have_zi = test_for('zope.interface') | |
54 | have_twisted = test_for('twisted') |
|
55 | have_twisted = test_for('twisted') | |
55 | have_foolscap = test_for('foolscap') |
|
56 | have_foolscap = test_for('foolscap') | |
@@ -67,8 +68,9 b' def make_exclude():' | |||||
67 | pjoin('IPython', 'frontend', 'process', 'winprocess.py'), |
|
68 | pjoin('IPython', 'frontend', 'process', 'winprocess.py'), | |
68 | pjoin('IPython_doctest_plugin'), |
|
69 | pjoin('IPython_doctest_plugin'), | |
69 | pjoin('IPython', 'extensions', 'ipy_'), |
|
70 | pjoin('IPython', 'extensions', 'ipy_'), | |
70 |
pjoin('IPython', 'extensions', ' |
|
71 | pjoin('IPython', 'extensions', 'PhysicalQInput'), | |
71 | pjoin('IPython', 'extensions', 'PhysicalQInteractive'), |
|
72 | pjoin('IPython', 'extensions', 'PhysicalQInteractive'), | |
|
73 | pjoin('IPython', 'extensions', 'InterpreterPasteInput'), | |||
72 | pjoin('IPython', 'extensions', 'scitedirector'), |
|
74 | pjoin('IPython', 'extensions', 'scitedirector'), | |
73 | pjoin('IPython', 'extensions', 'numeric_formats'), |
|
75 | pjoin('IPython', 'extensions', 'numeric_formats'), | |
74 | pjoin('IPython', 'testing', 'attic'), |
|
76 | pjoin('IPython', 'testing', 'attic'), | |
@@ -81,6 +83,9 b' def make_exclude():' | |||||
81 | EXCLUDE.append(pjoin('IPython', 'gui')) |
|
83 | EXCLUDE.append(pjoin('IPython', 'gui')) | |
82 | EXCLUDE.append(pjoin('IPython', 'frontend', 'wx')) |
|
84 | EXCLUDE.append(pjoin('IPython', 'frontend', 'wx')) | |
83 |
|
85 | |||
|
86 | if not have_wx_aui: | |||
|
87 | EXCLUDE.append(pjoin('IPython', 'gui', 'wx', 'wxIPython')) | |||
|
88 | ||||
84 | if not have_objc: |
|
89 | if not have_objc: | |
85 | EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa')) |
|
90 | EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa')) | |
86 |
|
91 | |||
@@ -111,6 +116,7 b' def make_exclude():' | |||||
111 |
|
116 | |||
112 | return EXCLUDE |
|
117 | return EXCLUDE | |
113 |
|
118 | |||
|
119 | ||||
114 | #----------------------------------------------------------------------------- |
|
120 | #----------------------------------------------------------------------------- | |
115 | # Functions and classes |
|
121 | # Functions and classes | |
116 | #----------------------------------------------------------------------------- |
|
122 | #----------------------------------------------------------------------------- | |
@@ -237,7 +243,7 b' def run_iptestall():' | |||||
237 | t_start = time.time() |
|
243 | t_start = time.time() | |
238 | for name,runner in runners.iteritems(): |
|
244 | for name,runner in runners.iteritems(): | |
239 | print '*'*77 |
|
245 | print '*'*77 | |
240 |
print 'IPython test |
|
246 | print 'IPython test group:',name | |
241 | res = runner.run() |
|
247 | res = runner.run() | |
242 | if res: |
|
248 | if res: | |
243 | failed[name] = res |
|
249 | failed[name] = res | |
@@ -248,14 +254,14 b' def run_iptestall():' | |||||
248 | # summarize results |
|
254 | # summarize results | |
249 |
|
255 | |||
250 | print '*'*77 |
|
256 | print '*'*77 | |
251 |
print 'Ran %s test |
|
257 | print 'Ran %s test groups in %.3fs' % (nrunners, t_tests) | |
252 |
|
258 | |||
253 | if not failed: |
|
259 | if not failed: | |
254 | print 'OK' |
|
260 | print 'OK' | |
255 | else: |
|
261 | else: | |
256 | # If anything went wrong, point out what command to rerun manually to |
|
262 | # If anything went wrong, point out what command to rerun manually to | |
257 | # see the actual errors and individual summary |
|
263 | # see the actual errors and individual summary | |
258 |
print 'ERROR - %s out of %s test |
|
264 | print 'ERROR - %s out of %s test groups failed.' % (nfail, nrunners) | |
259 | for name in failed: |
|
265 | for name in failed: | |
260 | failed_runner = runners[name] |
|
266 | failed_runner = runners[name] | |
261 | print '-'*40 |
|
267 | print '-'*40 |
@@ -208,6 +208,15 b' def start_ipython():' | |||||
208 | _ip.IP.magic_run_ori = _ip.IP.magic_run |
|
208 | _ip.IP.magic_run_ori = _ip.IP.magic_run | |
209 | _ip.IP.magic_run = im |
|
209 | _ip.IP.magic_run = im | |
210 |
|
210 | |||
|
211 | # XXX - For some very bizarre reason, the loading of %history by default is | |||
|
212 | # failing. This needs to be fixed later, but for now at least this ensures | |||
|
213 | # that tests that use %hist run to completion. | |||
|
214 | from IPython.core import history | |||
|
215 | history.init_ipython(_ip) | |||
|
216 | if not hasattr(_ip.IP,'magic_history'): | |||
|
217 | raise RuntimeError("Can't load magics, aborting") | |||
|
218 | ||||
|
219 | ||||
211 | # The start call MUST be made here. I'm not sure yet why it doesn't work if |
|
220 | # The start call MUST be made here. I'm not sure yet why it doesn't work if | |
212 | # it is made later, at plugin initialization time, but in all my tests, that's |
|
221 | # it is made later, at plugin initialization time, but in all my tests, that's | |
213 | # the case. |
|
222 | # the case. |
@@ -881,7 +881,7 b' def doctest_reload():' | |||||
881 |
|
881 | |||
882 | This routine: |
|
882 | This routine: | |
883 |
|
883 | |||
884 | - reloads doctest |
|
884 | - imports doctest but does NOT reload it (see below). | |
885 |
|
885 | |||
886 | - resets its global 'master' attribute to None, so that multiple uses of |
|
886 | - resets its global 'master' attribute to None, so that multiple uses of | |
887 | the module interactively don't produce cumulative reports. |
|
887 | the module interactively don't produce cumulative reports. | |
@@ -890,19 +890,19 b' def doctest_reload():' | |||||
890 | modified displayhook. Doctest expects the default displayhook behavior |
|
890 | modified displayhook. Doctest expects the default displayhook behavior | |
891 | deep down, so our modification breaks it completely. For this reason, a |
|
891 | deep down, so our modification breaks it completely. For this reason, a | |
892 | hard monkeypatch seems like a reasonable solution rather than asking |
|
892 | hard monkeypatch seems like a reasonable solution rather than asking | |
893 |
users to manually use a different doctest runner when under IPython. |
|
893 | users to manually use a different doctest runner when under IPython. | |
|
894 | ||||
|
895 | Note | |||
|
896 | ---- | |||
|
897 | ||||
|
898 | This function *used to* reload doctest, but this has been disabled because | |||
|
899 | reloading doctest unconditionally can cause massive breakage of other | |||
|
900 | doctest-dependent modules already in memory, such as those for IPython's | |||
|
901 | own testing system. The name wasn't changed to avoid breaking people's | |||
|
902 | code, but the reload call isn't actually made anymore.""" | |||
894 |
|
903 | |||
895 | import doctest |
|
904 | import doctest | |
896 | reload(doctest) |
|
|||
897 | doctest.master=None |
|
905 | doctest.master = None | |
898 |
|
||||
899 | try: |
|
|||
900 | doctest.DocTestRunner |
|
|||
901 | except AttributeError: |
|
|||
902 | # This is only for python 2.3 compatibility, remove once we move to |
|
|||
903 | # 2.4 only. |
|
|||
904 | pass |
|
|||
905 | else: |
|
|||
906 |
|
|
906 | doctest.DocTestRunner.run = dhook_wrap(doctest.DocTestRunner.run) | |
907 |
|
907 | |||
908 | #---------------------------------------------------------------------------- |
|
908 | #---------------------------------------------------------------------------- |
@@ -3,6 +3,8 b'' | |||||
3 |
|
3 | |||
4 | from IPython.kernel import client |
|
4 | from IPython.kernel import client | |
5 | import time |
|
5 | import time | |
|
6 | import sys | |||
|
7 | flush = sys.stdout.flush | |||
6 |
|
8 | |||
7 | tc = client.TaskClient() |
|
9 | tc = client.TaskClient() | |
8 | mec = client.MultiEngineClient() |
|
10 | mec = client.MultiEngineClient() | |
@@ -16,6 +18,7 b' for i in range(6):' | |||||
16 | time.sleep(1.0) |
|
18 | time.sleep(1.0) | |
17 | print "Queue status (vebose=False)" |
|
19 | print "Queue status (vebose=False)" | |
18 | print tc.queue_status() |
|
20 | print tc.queue_status() | |
|
21 | flush() | |||
19 |
|
22 | |||
20 | for i in range(24): |
|
23 | for i in range(24): | |
21 | tc.run(client.StringTask('time.sleep(1)')) |
|
24 | tc.run(client.StringTask('time.sleep(1)')) | |
@@ -24,12 +27,14 b' for i in range(6):' | |||||
24 | time.sleep(1.0) |
|
27 | time.sleep(1.0) | |
25 | print "Queue status (vebose=True)" |
|
28 | print "Queue status (vebose=True)" | |
26 | print tc.queue_status(True) |
|
29 | print tc.queue_status(True) | |
|
30 | flush() | |||
27 |
|
31 | |||
28 | for i in range(12): |
|
32 | for i in range(12): | |
29 | tc.run(client.StringTask('time.sleep(2)')) |
|
33 | tc.run(client.StringTask('time.sleep(2)')) | |
30 |
|
34 | |||
31 | print "Queue status (vebose=True)" |
|
35 | print "Queue status (vebose=True)" | |
32 | print tc.queue_status(True) |
|
36 | print tc.queue_status(True) | |
|
37 | flush() | |||
33 |
|
38 | |||
34 | qs = tc.queue_status(True) |
|
39 | qs = tc.queue_status(True) | |
35 | sched = qs['scheduled'] |
|
40 | sched = qs['scheduled'] | |
@@ -41,4 +46,5 b' for i in range(6):' | |||||
41 | time.sleep(1.0) |
|
46 | time.sleep(1.0) | |
42 | print "Queue status (vebose=True)" |
|
47 | print "Queue status (vebose=True)" | |
43 | print tc.queue_status(True) |
|
48 | print tc.queue_status(True) | |
|
49 | flush() | |||
44 |
|
50 |
@@ -1329,8 +1329,9 b' For stand-alone use of the feature in your programs which do not use' | |||||
1329 | IPython at all, put the following lines toward the top of your 'main' |
|
1329 | IPython at all, put the following lines toward the top of your 'main' | |
1330 | routine:: |
|
1330 | routine:: | |
1331 |
|
1331 | |||
1332 |
import sys |
|
1332 | import sys | |
1333 | sys.excepthook = IPython.ultraTB.FormattedTB(mode='Verbose', |
|
1333 | from IPython.core import ultratb | |
|
1334 | sys.excepthook = ultratb.FormattedTB(mode='Verbose', | |||
1334 | color_scheme='Linux', call_pdb=1) |
|
1335 | color_scheme='Linux', call_pdb=1) | |
1335 |
|
1336 | |||
1336 | The mode keyword can be either 'Verbose' or 'Plain', giving either very |
|
1337 | The mode keyword can be either 'Verbose' or 'Plain', giving either very |
General Comments 0
You need to be logged in to leave comments.
Login now