@@ -30,21 +30,37 @@ def eiger_controller():
30
30
yield EigerController ("i04-1-eiger01" , 80 )
31
31
32
32
33
+ # Stolen from tickit-devices
34
+ # https://docs.pytest.org/en/latest/example/parametrize.html#indirect-parametrization
33
35
@pytest .fixture
34
- def sim_eiger_controller ():
35
- cmd = ["tickit" , "all" , str (HERE / "eiger.yaml" )]
36
- sim = subprocess .Popen (cmd )
36
+ def sim_eiger_controller (request ):
37
+ """Subprocess that runs ``tickit all <config_path>``."""
38
+ config_path : str = request .param
39
+ proc = subprocess .Popen (
40
+ ["tickit" , "all" , config_path ],
41
+ stdout = subprocess .PIPE ,
42
+ stderr = subprocess .STDOUT ,
43
+ text = True ,
44
+ )
45
+
46
+ # Wait until ready
47
+ while True :
48
+ line = proc .stdout .readline ()
49
+ if "Starting HTTP server..." in line :
50
+ break
37
51
38
52
sleep (3 )
39
53
40
54
yield EigerController ("127.0.0.1" , 8081 )
41
55
42
- sim .send_signal (signal .SIGTERM )
43
- sleep (0.1 )
44
- sim .kill ()
56
+ proc .send_signal (signal .SIGINT )
57
+ print (proc .communicate ()[0 ])
45
58
46
59
47
60
@pytest .mark .asyncio
61
+ @pytest .mark .parametrize (
62
+ "sim_eiger_controller" , [str (HERE / "eiger.yaml" )], indirect = True
63
+ )
48
64
async def test_introspection (sim_eiger_controller : EigerController ):
49
65
controller = sim_eiger_controller
50
66
# controller = eiger_controller
0 commit comments