File tree 5 files changed +14
-14
lines changed
5 files changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ docs = [
54
54
" trio"
55
55
]
56
56
test = [
57
- " pytest>=7.0,<8 " ,
57
+ " pytest>=7.0,<9 " ,
58
58
" pytest-cov" ,
59
59
" flaky" ,
60
60
" ipyparallel" ,
Original file line number Diff line number Diff line change 7
7
import tempfile
8
8
from unittest .mock import patch
9
9
10
+ import pytest
11
+
10
12
from ipykernel .kernelspec import install
11
13
12
14
pjoin = os .path .join
15
17
patchers : list = []
16
18
17
19
18
- def setup ():
20
+ @pytest .fixture (autouse = True )
21
+ def _global_setup ():
19
22
"""setup temporary env for tests"""
20
23
global tmp
21
24
tmp = tempfile .mkdtemp ()
@@ -34,9 +37,7 @@ def setup():
34
37
35
38
# install IPython in the temp home:
36
39
install (user = True )
37
-
38
-
39
- def teardown ():
40
+ yield
40
41
for p in patchers :
41
42
p .stop ()
42
43
Original file line number Diff line number Diff line change 11
11
KC = KM = None
12
12
13
13
14
- def setup_function ():
14
+ @pytest .fixture (autouse = True )
15
+ def _setup_env ():
15
16
"""start the global kernel (if it isn't running) and return its client"""
16
17
global KM , KC
17
18
KM , KC = start_new_kernel ()
18
19
flush_channels (KC )
19
-
20
-
21
- def teardown_function ():
20
+ yield
22
21
assert KC is not None
23
22
assert KM is not None
24
23
KC .stop_channels ()
Original file line number Diff line number Diff line change @@ -42,14 +42,13 @@ def _get_qt_vers():
42
42
_get_qt_vers ()
43
43
44
44
45
- def setup ():
45
+ @pytest .fixture (autouse = True )
46
+ def _setup_env ():
46
47
"""start the global kernel (if it isn't running) and return its client"""
47
48
global KM , KC
48
49
KM , KC = start_new_kernel ()
49
50
flush_channels (KC )
50
-
51
-
52
- def teardown ():
51
+ yield
53
52
assert KM is not None
54
53
assert KC is not None
55
54
KC .stop_channels ()
Original file line number Diff line number Diff line change 22
22
KC : BlockingKernelClient = None # type:ignore
23
23
24
24
25
- def setup ():
25
+ @pytest .fixture (autouse = True )
26
+ def _setup_env ():
26
27
global KC
27
28
KC = start_global_kernel ()
28
29
You can’t perform that action at this time.
0 commit comments