1
1
import asyncio
2
2
import time
3
- from typing import Callable , Iterator
3
+ from typing import Callable
4
4
5
5
import pytest
6
- from distributed .client import Client
7
6
8
7
from adaptive .learner import BaseLearner , Learner1D , Learner2D
9
8
from adaptive .runner import (
@@ -71,7 +70,7 @@ async def f(x):
71
70
72
71
73
72
@pytest .fixture (scope = "session" )
74
- def ipyparallel_executor () -> Iterator [ Client ] :
73
+ def ipyparallel_executor ():
75
74
from ipyparallel import Client
76
75
import pexpect
77
76
@@ -83,7 +82,7 @@ def ipyparallel_executor() -> Iterator[Client]:
83
82
84
83
85
84
@pytest .fixture (scope = "session" )
86
- def dask_executor () -> Iterator [ Client ] :
85
+ def dask_executor ():
87
86
from distributed import Client
88
87
89
88
client = Client (n_workers = 1 )
@@ -114,15 +113,15 @@ def test_stop_after_goal() -> None:
114
113
115
114
116
115
@pytest .mark .skipif (not with_ipyparallel , reason = "IPyparallel is not installed" )
117
- def test_ipyparallel_executor (ipyparallel_executor : Client ) -> None :
116
+ def test_ipyparallel_executor (ipyparallel_executor ) -> None :
118
117
learner = Learner1D (linear , (- 1 , 1 ))
119
118
BlockingRunner (learner , trivial_goal , executor = ipyparallel_executor )
120
119
assert learner .npoints > 0
121
120
122
121
123
122
@pytest .mark .timeout (60 )
124
123
@pytest .mark .skipif (not with_distributed , reason = "dask.distributed is not installed" )
125
- def test_distributed_executor (dask_executor : Client ) -> None :
124
+ def test_distributed_executor (dask_executor ) -> None :
126
125
learner = Learner1D (linear , (- 1 , 1 ))
127
126
BlockingRunner (learner , trivial_goal , executor = dask_executor )
128
127
assert learner .npoints > 0
0 commit comments