aboutsummaryrefslogtreecommitdiff
path: root/development/jupyter-ipykernel/add-compat-with-pytest-8.patch
blob: 19c708170283a2f19640b6ff5b2ffe43a323c418 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -7,6 +7,8 @@
 import tempfile
 from unittest.mock import patch
 
+import pytest
+
 from ipykernel.kernelspec import install
 
 pjoin = os.path.join
@@ -15,7 +17,8 @@
 patchers: list = []
 
 
-def setup():
+@pytest.fixture(autouse=True)
+def _global_setup():
     """setup temporary env for tests"""
     global tmp
     tmp = tempfile.mkdtemp()
@@ -34,9 +37,7 @@
 
     # install IPython in the temp home:
     install(user=True)
-
-
-def teardown():
+    yield
     for p in patchers:
         p.stop()

--- a/tests/test_async.py
+++ b/tests/test_async.py
@@ -8,14 +8,13 @@
 KC = KM = None
 
 
-def setup_function():
+@pytest.fixture(autouse=True)
+def _setup_env():
     """start the global kernel (if it isn't running) and return its client"""
     global KM, KC
     KM, KC = start_new_kernel()
     flush_channels(KC)
-
-
-def teardown_function():
+    yield
     assert KC is not None
     assert KM is not None
     KC.stop_channels()
--- a/tests/test_eventloop.py
+++ b/tests/test_eventloop.py
@@ -42,14 +42,13 @@
 _get_qt_vers()
 
 
-def setup():
+@pytest.fixture(autouse=True)
+def _setup_env():
     """start the global kernel (if it isn't running) and return its client"""
     global KM, KC
     KM, KC = start_new_kernel()
     flush_channels(KC)
-
-
-def teardown():
+    yield
     assert KM is not None
     assert KC is not None
     KC.stop_channels()
--- a/tests/test_message_spec.py
+++ b/tests/test_message_spec.py
@@ -21,7 +21,8 @@
 KC: BlockingKernelClient = None  # type:ignore
 
 
-def setup():
+@pytest.fixture(autouse=True)
+def _setup_env():
     global KC
     KC = start_global_kernel()