Merge "Bug 502 improvements"
[osm/N2VC.git] / modules / libjuju / tests / integration / test_machine.py
index 60de035..8957ae1 100644 (file)
@@ -1,8 +1,8 @@
 import asyncio
-import pytest
-
 from tempfile import NamedTemporaryFile
 
+import pytest
+
 from .. import base
 
 
@@ -28,7 +28,8 @@ async def test_status(event_loop):
 
         await asyncio.wait_for(
             model.block_until(lambda: (machine.status == 'running' and
-                                       machine.agent_status == 'started')),
+                                       machine.agent_status == 'started' and
+                                       machine.agent_version is not None)),
             timeout=480)
 
         assert machine.status == 'running'
@@ -41,6 +42,11 @@ async def test_status(event_loop):
 @base.bootstrapped
 @pytest.mark.asyncio
 async def test_scp(event_loop):
+    # ensure that asyncio.subprocess will work;
+    try:
+        asyncio.get_child_watcher().attach_loop(event_loop)
+    except RuntimeError:
+        pytest.skip('test_scp will always fail outside of MainThread')
     async with base.CleanModel() as model:
         await model.add_machine()
         await asyncio.wait_for(