Show More
@@ -56,33 +56,6 b' class StreamProxy(io.IOStream):' | |||
|
56 | 56 | def flush(self): |
|
57 | 57 | self.stream.flush() |
|
58 | 58 | |
|
59 | # Hack to modify the %run command so we can sync the user's namespace with the | |
|
60 | # test globals. Once we move over to a clean magic system, this will be done | |
|
61 | # with much less ugliness. | |
|
62 | ||
|
63 | class py_file_finder(object): | |
|
64 | def __init__(self,test_filename): | |
|
65 | self.test_filename = test_filename | |
|
66 | ||
|
67 | def __call__(self,name,win32=False): | |
|
68 | from IPython.utils.path import get_py_filename | |
|
69 | try: | |
|
70 | return get_py_filename(name,win32=win32) | |
|
71 | except IOError: | |
|
72 | test_dir = os.path.dirname(self.test_filename) | |
|
73 | new_path = os.path.join(test_dir,name) | |
|
74 | return get_py_filename(new_path,win32=win32) | |
|
75 | ||
|
76 | ||
|
77 | def _run_ns_sync(self,arg_s,runner=None): | |
|
78 | """Modified version of %run that syncs testing namespaces. | |
|
79 | ||
|
80 | This is strictly needed for running doctests that call %run. | |
|
81 | """ | |
|
82 | #print('in run_ns_sync', arg_s, file=sys.stderr) # dbg | |
|
83 | finder = py_file_finder(arg_s) | |
|
84 | return get_ipython().magic_run_ori(arg_s, runner, finder) | |
|
85 | ||
|
86 | 59 | |
|
87 | 60 | def get_ipython(): |
|
88 | 61 | # This will get replaced by the real thing once we start IPython below |
General Comments 0
You need to be logged in to leave comments.
Login now