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