Skip to content

Commit 5294c06

Browse files
committed
skip with pytest marks instead of genutils decorators
1 parent df40782 commit 5294c06

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

jupyter_client/tests/test_kernelmanager.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313
import time
1414
from unittest import TestCase
1515

16-
from ipython_genutils.testing import decorators as dec
17-
1816
from traitlets.config.loader import Config
1917
from jupyter_core import paths
2018
from jupyter_client import KernelManager
2119
from ..manager import start_new_kernel
22-
from .utils import test_env
20+
from .utils import test_env, skip_win32
2321

2422
TIMEOUT = 30
2523

@@ -67,7 +65,7 @@ def test_tcp_lifecycle(self):
6765
km = self._get_tcp_km()
6866
self._run_lifecycle(km)
6967

70-
@dec.skip_win32
68+
@skip_win32
7169
def test_ipc_lifecycle(self):
7270
km = self._get_ipc_km()
7371
self._run_lifecycle(km)
@@ -82,8 +80,8 @@ def test_get_connect_info(self):
8280
'key', 'signature_scheme',
8381
])
8482
self.assertEqual(keys, expected)
85-
86-
@dec.skip_win32
83+
84+
@skip_win32
8785
def test_signal_kernel_subprocesses(self):
8886
self._install_test_kernel()
8987
km, kc = start_new_kernel(kernel_name='signaltest')

jupyter_client/tests/test_kernelspec.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
import sys
1414
import unittest
1515

16+
import pytest
17+
1618
if str is bytes: # py2
1719
StringIO = io.BytesIO
1820
else:
1921
StringIO = io.StringIO
2022

21-
from ipython_genutils.testing.decorators import onlyif
2223
from ipython_genutils.tempdir import TemporaryDirectory
2324
from jupyter_client import kernelspec
2425
from jupyter_core import paths
@@ -123,7 +124,9 @@ def test_install_kernel_spec_prefix(self):
123124
self.ksm.log.removeHandler(handler)
124125
self.assertNotIn("may not be found", captured)
125126

126-
@onlyif(os.name != 'nt' and not os.access('/usr/local/share', os.W_OK), "needs Unix system without root privileges")
127+
@pytest.mark.skipif(
128+
not (os.name != 'nt' and not os.access('/usr/local/share', os.W_OK)),
129+
reason="needs Unix system without root privileges")
127130
def test_cant_install_kernel_spec(self):
128131
with self.assertRaises(OSError):
129132
self.ksm.install_kernel_spec(self.installable_kernel,

jupyter_client/tests/test_multikernelmanager.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
import time
55
from unittest import TestCase
66

7-
from ipython_genutils.testing import decorators as dec
8-
97
from traitlets.config.loader import Config
108
from ..localinterfaces import localhost
119
from jupyter_client import KernelManager
1210
from jupyter_client.multikernelmanager import MultiKernelManager
11+
from .utils import skip_win32
1312

1413
class TestKernelManager(TestCase):
1514

@@ -75,12 +74,12 @@ def test_tcp_cinfo(self):
7574
km = self._get_tcp_km()
7675
self._run_cinfo(km, 'tcp', localhost())
7776

78-
@dec.skip_win32
77+
@skip_win32
7978
def test_ipc_lifecycle(self):
8079
km = self._get_ipc_km()
8180
self._run_lifecycle(km)
8281

83-
@dec.skip_win32
82+
@skip_win32
8483
def test_ipc_cinfo(self):
8584
km = self._get_ipc_km()
8685
self._run_cinfo(km, 'ipc', 'test')

jupyter_client/tests/test_session.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import uuid
99
from datetime import datetime
1010

11+
import pytest
12+
1113
import zmq
1214

1315
from zmq.tests import BaseZMQTestCase
@@ -16,7 +18,6 @@
1618
from jupyter_client import session as ss
1719
from jupyter_client import jsonutil
1820

19-
from ipython_genutils.testing.decorators import skipif, module_not_available
2021
from ipython_genutils.py3compat import string_types
2122

2223
def _bad_packer(obj):
@@ -286,9 +287,8 @@ def test_datetimes_pickle(self):
286287
session = ss.Session(packer='pickle')
287288
self._datetime_test(session)
288289

289-
@skipif(module_not_available('msgpack'))
290290
def test_datetimes_msgpack(self):
291-
import msgpack
291+
msgpack = pytest.importorskip('msgpack')
292292

293293
session = ss.Session(
294294
pack=msgpack.packb,

jupyter_client/tests/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
"""
44
import os
55
pjoin = os.path.join
6+
import sys
67
try:
78
from unittest.mock import patch
89
except ImportError:
910
from mock import patch
1011

12+
import pytest
13+
1114
from ipython_genutils.tempdir import TemporaryDirectory
1215

16+
17+
skip_win32 = pytest.mark.skipif(sys.platform.startswith('win'), reason="Windows")
18+
19+
1320
class test_env(object):
1421
"""Set Jupyter path variables to a temporary directory
1522

0 commit comments

Comments
 (0)