##// END OF EJS Templates
Make a few test non-optional....
Matthias Bussonnier -
Show More
@@ -2,7 +2,6 b''
2 2 # Distributed under the terms of the Modified BSD License.
3 3
4 4 import json
5 import tempfile
6 5 import os
7 6 import warnings
8 7
@@ -39,6 +39,8 b' else:'
39 39 from StringIO import StringIO
40 40
41 41
42 _ip = get_ipython()
43
42 44 @magic.magics_class
43 45 class DummyMagics(magic.Magics): pass
44 46
@@ -89,7 +91,6 b' def test_config():'
89 91
90 92 def test_rehashx():
91 93 # clear up everything
92 _ip = get_ipython()
93 94 _ip.alias_manager.clear_aliases()
94 95 del _ip.db['syscmdlist']
95 96
@@ -625,7 +626,6 b' def test_extension():'
625 626 sys.path.remove(daft_path)
626 627
627 628
628 @dec.skip_without('nbformat')
629 629 def test_notebook_export_json():
630 630 _ip = get_ipython()
631 631 _ip.history_manager.reset() # Clear any existing history.
@@ -254,22 +254,22 b' class TestMagicRunSimple(tt.TempFileMixin):'
254 254
255 255 Returning from another run magic deletes the namespace"""
256 256 # see ticket https://github.com/ipython/ipython/issues/238
257 class secondtmp(tt.TempFileMixin): pass
258 empty = secondtmp()
259 empty.mktmp('')
260 # On Windows, the filename will have \users in it, so we need to use the
261 # repr so that the \u becomes \\u.
262 src = ("ip = get_ipython()\n"
263 "for i in range(5):\n"
264 " try:\n"
265 " ip.magic(%r)\n"
266 " except NameError as e:\n"
267 " print(i)\n"
268 " break\n" % ('run ' + empty.fname))
269 self.mktmp(src)
270 _ip.magic('run %s' % self.fname)
271 _ip.run_cell('ip == get_ipython()')
272 nt.assert_equal(_ip.user_ns['i'], 4)
257
258 with tt.TempFileMixin() as empty:
259 empty.mktmp('')
260 # On Windows, the filename will have \users in it, so we need to use the
261 # repr so that the \u becomes \\u.
262 src = ("ip = get_ipython()\n"
263 "for i in range(5):\n"
264 " try:\n"
265 " ip.magic(%r)\n"
266 " except NameError as e:\n"
267 " print(i)\n"
268 " break\n" % ('run ' + empty.fname))
269 self.mktmp(src)
270 _ip.magic('run %s' % self.fname)
271 _ip.run_cell('ip == get_ipython()')
272 nt.assert_equal(_ip.user_ns['i'], 4)
273 273
274 274 def test_run_second(self):
275 275 """Test that running a second file doesn't clobber the first, gh-3547
@@ -278,12 +278,12 b' class TestMagicRunSimple(tt.TempFileMixin):'
278 278 "def afunc():\n"
279 279 " return avar\n")
280 280
281 empty = tt.TempFileMixin()
282 empty.mktmp("")
283
284 _ip.magic('run %s' % self.fname)
285 _ip.magic('run %s' % empty.fname)
286 nt.assert_equal(_ip.user_ns['afunc'](), 1)
281 with tt.TempFileMixin() as empty:
282 empty.mktmp("")
283
284 _ip.magic('run %s' % self.fname)
285 _ip.magic('run %s' % empty.fname)
286 nt.assert_equal(_ip.user_ns['afunc'](), 1)
287 287
288 288 @dec.skip_win32
289 289 def test_tclass(self):
@@ -25,6 +25,5 b' def test_locate_help():'
25 25 def test_locate_profile_help():
26 26 tt.help_all_output_test("locate profile")
27 27
28 @skip_without('nbformat') # Requires jsonschema to be installed
29 28 def test_trust_help():
30 29 tt.help_all_output_test("trust")
@@ -44,6 +44,7 b' pjoin = path.join'
44 44
45 45
46 46 # Enable printing all warnings raise by IPython's modules
47 warnings.filterwarnings('ignore', message='.*Matplotlib is building the font cache.*', category=UserWarning, module='.*')
47 48 if sys.version_info > (3,0):
48 49 warnings.filterwarnings('error', message='.*', category=ResourceWarning, module='.*')
49 50 warnings.filterwarnings('default', message='.*', category=Warning, module='IPy.*')
@@ -303,6 +303,13 b' class TempFileMixin(object):'
303 303 # delete it. I have no clue why
304 304 pass
305 305
306 def __enter__(self):
307 return self
308
309 def __exit__(self, exc_type, exc_value, traceback):
310 self.tearDown()
311
312
306 313 pair_fail_msg = ("Testing {0}\n\n"
307 314 "In:\n"
308 315 " {1!r}\n"
@@ -182,13 +182,14 b' extras_require = dict('
182 182 parallel = ['ipyparallel'],
183 183 qtconsole = ['qtconsole'],
184 184 doc = ['Sphinx>=1.3'],
185 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments'],
185 test = ['nose>=0.10.1', 'requests', 'testpath', 'pygments', 'nbformat', 'ipykernel'],
186 186 terminal = [],
187 187 kernel = ['ipykernel'],
188 188 nbformat = ['nbformat'],
189 189 notebook = ['notebook', 'ipywidgets'],
190 190 nbconvert = ['nbconvert'],
191 191 )
192
192 193 install_requires = [
193 194 'setuptools>=18.5',
194 195 'decorator',
General Comments 0
You need to be logged in to leave comments. Login now