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