##// END OF EJS Templates
Properly don't require numpy to run tests....
Matthias Bussonnier -
Show More
@@ -183,7 +183,7 b' def test_forward_unicode_completion():'
183 183 nt.assert_equal(matches[0], 'Ⅴ')
184 184
185 185 @nt.nottest # now we have a completion for \jmath
186 @decorators.dec.knownfailureif(sys.platform == 'win32', 'Fails if there is a C:\\j... path')
186 @decorators.knownfailureif(sys.platform == 'win32', 'Fails if there is a C:\\j... path')
187 187 def test_no_ascii_back_completion():
188 188 ip = get_ipython()
189 189 with TemporaryWorkingDirectory(): # Avoid any filename completions
@@ -234,7 +234,7 b' def test_has_open_quotes4():'
234 234 nt.assert_false(completer.has_open_quotes(s))
235 235
236 236
237 @decorators.dec.knownfailureif(sys.platform == 'win32', "abspath completions fail on Windows")
237 @decorators.knownfailureif(sys.platform == 'win32', "abspath completions fail on Windows")
238 238 def test_abspath_file_completions():
239 239 ip = get_ipython()
240 240 with TemporaryDirectory() as tmpdir:
@@ -538,7 +538,7 b' def test_run_tb():'
538 538 nt.assert_in("RuntimeError", out)
539 539 nt.assert_equal(out.count("---->"), 3)
540 540
541 @dec.dec.knownfailureif(sys.platform == 'win32', "writes to io.stdout aren't captured on Windows")
541 @dec.knownfailureif(sys.platform == 'win32', "writes to io.stdout aren't captured on Windows")
542 542 def test_script_tb():
543 543 """Test traceback offset in `ipython script.py`"""
544 544 with TemporaryDirectory() as td:
@@ -1,9 +1,7 b''
1 1 try:
2 from numpy.testing import *
3 from numpy.testing import dec
4 from numpy.testing.noseclasses import KnownFailure
2 from numpy.testing.noseclasses import KnownFailure, knownfailureif
5 3 except ImportError:
6 from ._decorators import *
4 from ._decorators import knownfailureif
7 5 try:
8 6 from ._numpy_testing_noseclasses import KnownFailure
9 7 except ImportError:
@@ -26,11 +26,17 b' from io import BytesIO'
26 26
27 27 # Third-party imports
28 28 import nose.tools as nt
29 import numpy
29
30 try:
31 import numpy
32 except ImportError:
33 pass
30 34
31 35 # Our own imports
32 36 from IPython.lib import display
33 37
38 from IPython.testing.decorators import skipif_not_numpy
39
34 40 #-----------------------------------------------------------------------------
35 41 # Classes and functions
36 42 #-----------------------------------------------------------------------------
@@ -188,19 +194,24 b' def test_audio_from_file():'
188 194 display.Audio(filename=path)
189 195
190 196 class TestAudioDataWithNumpy(TestCase):
197
198 @skipif_not_numpy
191 199 def test_audio_from_numpy_array(self):
192 200 test_tone = get_test_tone()
193 201 audio = display.Audio(test_tone, rate=44100)
194 202 nt.assert_equal(len(read_wav(audio.data)), len(test_tone))
195 203
204 @skipif_not_numpy
196 205 def test_audio_from_list(self):
197 206 test_tone = get_test_tone()
198 207 audio = display.Audio(list(test_tone), rate=44100)
199 208 nt.assert_equal(len(read_wav(audio.data)), len(test_tone))
200 209
210 @skipif_not_numpy
201 211 def test_audio_from_numpy_array_without_rate_raises(self):
202 212 nt.assert_raises(ValueError, display.Audio, get_test_tone())
203 213
214 @skipif_not_numpy
204 215 def test_audio_data_normalization(self):
205 216 expected_max_value = numpy.iinfo(numpy.int16).max
206 217 for scale in [1, 0.5, 2]:
@@ -208,6 +219,7 b' class TestAudioDataWithNumpy(TestCase):'
208 219 actual_max_value = numpy.max(numpy.abs(read_wav(audio.data)))
209 220 nt.assert_equal(actual_max_value, expected_max_value)
210 221
222 @skipif_not_numpy
211 223 def test_audio_data_without_normalization(self):
212 224 max_int16 = numpy.iinfo(numpy.int16).max
213 225 for scale in [1, 0.5, 0.2]:
@@ -233,6 +245,7 b' def simulate_numpy_not_installed():'
233 245 class TestAudioDataWithoutNumpy(TestAudioDataWithNumpy):
234 246 # All tests from `TestAudioDataWithNumpy` are inherited.
235 247
248 @skipif_not_numpy
236 249 def test_audio_raises_for_nested_list(self):
237 250 stereo_signal = [list(get_test_tone())] * 2
238 251 nt.assert_raises(
@@ -47,7 +47,7 b' from .ipunittest import ipdoctest, ipdocstring'
47 47 # Grab the numpy-specific decorators which we keep in a file that we
48 48 # occasionally update from upstream: decorators.py is a copy of
49 49 # numpy.testing.decorators, we expose all of it here.
50 from IPython.external.decorators import *
50 from IPython.external.decorators import knownfailureif
51 51
52 52 #-----------------------------------------------------------------------------
53 53 # Classes and functions
@@ -333,7 +333,7 b" skipif_not_matplotlib = skip_without('matplotlib')"
333 333
334 334 skipif_not_sympy = skip_without('sympy')
335 335
336 skip_known_failure = dec.knownfailureif(True,'This test is known to fail')
336 skip_known_failure = knownfailureif(True,'This test is known to fail')
337 337
338 338 # A null 'decorator', useful to make more readable code that needs to pick
339 339 # between different decorators based on OS or other conditions
@@ -37,7 +37,7 b' from IPython import version_info'
37 37 from IPython.utils.py3compat import decode
38 38 from IPython.utils.importstring import import_item
39 39 from IPython.testing.plugin.ipdoctest import IPythonDoctest
40 from IPython.external.decorators import KnownFailure, dec
40 from IPython.external.decorators import KnownFailure, knownfailureif
41 41
42 42 pjoin = path.join
43 43
General Comments 0
You need to be logged in to leave comments. Login now