Skip to content

Commit 7578d91

Browse files
cdericiAflynn50
authored andcommitted
Provide running loop in tests where event_loop is needed
1 parent abd7bef commit 7578d91

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

tests/integration/test_unit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from tempfile import NamedTemporaryFile
77
import pytest
88

9-
from juju import utils
9+
from juju import utils, jasyncio
1010

1111
from .. import base
1212

@@ -137,7 +137,7 @@ async def run_action(unit):
137137
async def test_scp(event_loop):
138138
# ensure that asyncio.subprocess will work;
139139
try:
140-
asyncio.get_child_watcher().attach_loop(event_loop)
140+
asyncio.get_child_watcher().attach_loop(jasyncio.get_running_loop())
141141
except RuntimeError:
142142
pytest.skip('test_scp will always fail outside of MainThread')
143143
async with base.CleanModel() as model:
@@ -171,7 +171,7 @@ async def test_scp(event_loop):
171171
async def test_ssh(event_loop):
172172
# ensure that asyncio.subprocess will work;
173173
try:
174-
asyncio.get_child_watcher().attach_loop(event_loop)
174+
asyncio.get_child_watcher().attach_loop(jasyncio.get_running_loop())
175175
except RuntimeError:
176176
pytest.skip('test_ssh will always fail outside of MainThread')
177177
async with base.CleanModel() as model:

0 commit comments

Comments
 (0)