Skip to content

Commit abefee4

Browse files
authored
Merge pull request #750 from blink1073/nose-cleanup
Remove more nose test references
2 parents db5f708 + cfc16db commit abefee4

File tree

6 files changed

+27
-35
lines changed

6 files changed

+27
-35
lines changed

README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,26 @@ This package provides the IPython kernel for Jupyter.
66

77
1. `git clone`
88
2. `cd ipykernel`
9-
3. `pip install -e .`
9+
3. `pip install -e ".[test]"`
1010

1111
After that, all normal `ipython` commands will use this newly-installed version of the kernel.
1212

1313
## Running tests
1414

15-
Ensure you have `nosetests` and the `nose-warnings-filters` plugin installed with
16-
17-
```bash
18-
pip install nose nose-warnings-filters
19-
```
15+
Follow the instructions from `Installation from source`.
2016

2117
and then from the root directory
2218

2319
```bash
24-
nosetests ipykernel
20+
pytest ipykernel
2521
```
2622

2723
## Running tests with coverage
2824

29-
Follow the instructions from `Running tests`. Ensure you have the `coverage` module installed with
30-
31-
```bash
32-
pip install coverage
33-
```
25+
Follow the instructions from `Installation from source`.
3426

3527
and then from the root directory
3628

3729
```bash
38-
nosetests --with-coverage --cover-package ipykernel ipykernel
30+
pytest ipykernel -vv -s --cov ipykernel --cov-branch --cov-report term-missing:skip-covered --durations 10
3931
```

ipykernel/tests/test_io.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
import zmq
66

7+
import pytest
8+
79
from jupyter_client.session import Session
810
from ipykernel.iostream import IOPubThread, OutStream
911

10-
import nose.tools as nt
1112

1213
def test_io_api():
1314
"""Test that wrapped stdout has the same API as a normal TextIO object"""
@@ -26,19 +27,19 @@ def test_io_api():
2627

2728
assert stream.errors is None
2829
assert not stream.isatty()
29-
with nt.assert_raises(io.UnsupportedOperation):
30+
with pytest.raises(io.UnsupportedOperation):
3031
stream.detach()
31-
with nt.assert_raises(io.UnsupportedOperation):
32+
with pytest.raises(io.UnsupportedOperation):
3233
next(stream)
33-
with nt.assert_raises(io.UnsupportedOperation):
34+
with pytest.raises(io.UnsupportedOperation):
3435
stream.read()
35-
with nt.assert_raises(io.UnsupportedOperation):
36+
with pytest.raises(io.UnsupportedOperation):
3637
stream.readline()
37-
with nt.assert_raises(io.UnsupportedOperation):
38+
with pytest.raises(io.UnsupportedOperation):
3839
stream.seek(0)
39-
with nt.assert_raises(io.UnsupportedOperation):
40+
with pytest.raises(io.UnsupportedOperation):
4041
stream.tell()
41-
with nt.assert_raises(TypeError):
42+
with pytest.raises(TypeError):
4243
stream.write(b'')
4344

4445
def test_io_isatty():

ipykernel/tests/test_jsonutil.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from datetime import datetime
1010
import numbers
1111

12-
import nose.tools as nt
12+
import pytest
1313

1414
from .. import jsonutil
1515
from ..jsonutil import json_clean, encode_images
@@ -84,7 +84,7 @@ def test_encode_images():
8484
assert decoded == value
8585

8686
def test_lambda():
87-
with nt.assert_raises(ValueError):
87+
with pytest.raises(ValueError):
8888
json_clean(lambda : 1)
8989

9090

@@ -93,7 +93,8 @@ def test_exception():
9393
{True:'bool', 'True':'string'},
9494
]
9595
for d in bad_dicts:
96-
nt.assert_raises(ValueError, json_clean, d)
96+
with pytest.raises(ValueError):
97+
json_clean(d)
9798

9899

99100
def test_unicode_dict():

ipykernel/tests/test_message_spec.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from distutils.version import LooseVersion as V
99
from queue import Empty
1010

11-
import nose.tools as nt
12-
1311
import pytest
1412

1513
import jupyter_client
@@ -295,7 +293,9 @@ def test_execute_silent():
295293
validate_message(status, 'status', msg_id)
296294
assert status['content']['execution_state'] == 'idle'
297295

298-
nt.assert_raises(Empty, KC.get_iopub_msg, timeout=0.1)
296+
with pytest.raises(Empty):
297+
KC.get_iopub_msg(timeout=0.1)
298+
299299
count = reply['execution_count']
300300

301301
msg_id, reply = execute(code='x=2', silent=True)
@@ -305,7 +305,9 @@ def test_execute_silent():
305305
validate_message(status, 'status', msg_id)
306306
assert status['content']['execution_state'] == 'idle'
307307

308-
nt.assert_raises(Empty, KC.get_iopub_msg, timeout=0.1)
308+
with pytest.raises(Empty):
309+
KC.get_iopub_msg(timeout=0.1)
310+
309311
count_2 = reply['execution_count']
310312
assert count_2 == count
311313

@@ -389,11 +391,11 @@ def test_user_expressions():
389391

390392
msg_id, reply = execute(code='x=1', user_expressions=dict(foo='x+1'))
391393
user_expressions = reply['user_expressions']
392-
nt.assert_equal(user_expressions, {'foo': {
394+
assert user_expressions == {'foo': {
393395
'status': 'ok',
394396
'data': {'text/plain': '2'},
395397
'metadata': {},
396-
}})
398+
}}
397399

398400

399401
def test_user_expressions_fail():

setup.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ universal=0
66
license_file = COPYING.md
77
version = attr: ipykernel._version.__version__
88

9-
[nosetests]
10-
warningfilters= default |.* |DeprecationWarning |ipykernel.*
11-
error |.*invalid.* |DeprecationWarning |matplotlib.*
12-
139
[flake8]
1410
# References:
1511
# https://flake8.readthedocs.io/en/latest/user/configuration.html

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def run(self):
7777
"pytest !=5.3.4",
7878
"pytest-cov",
7979
"flaky",
80-
"nose", # nose because there are still a few nose.tools imports hanging around
80+
"nose", # nose because we are still using nose streams from ipython
8181
"ipyparallel",
8282
],
8383
},

0 commit comments

Comments
 (0)