mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-31 05:13:49 +02:00
Further test fixes
+ tests/dynamips/test_hypervisor.py: Increase sleep time to prevent random test failures + tests/iou/test_iou_device.py: Rework test skipping based on presence of IOU image rather than environment variable
This commit is contained in:
parent
9b010d6388
commit
4a4a57e1a3
@ -1,6 +1,7 @@
|
|||||||
from gns3server.modules.dynamips import Hypervisor
|
from gns3server.modules.dynamips import Hypervisor
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
def test_is_started(hypervisor):
|
def test_is_started(hypervisor):
|
||||||
@ -37,6 +38,6 @@ def test_stdout():
|
|||||||
hypervisor = Hypervisor(dynamips_path, "/tmp", "127.0.0.1", 7200)
|
hypervisor = Hypervisor(dynamips_path, "/tmp", "127.0.0.1", 7200)
|
||||||
hypervisor.start()
|
hypervisor.start()
|
||||||
# give some time for Dynamips to start
|
# give some time for Dynamips to start
|
||||||
time.sleep(0.01)
|
time.sleep(0.1)
|
||||||
output = hypervisor.read_stdout()
|
output = hypervisor.read_stdout()
|
||||||
assert output
|
assert output
|
||||||
|
@ -3,6 +3,16 @@ import os
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
def no_iou():
|
||||||
|
cwd = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
iou_path = os.path.join(cwd, "i86bi_linux-ipbase-ms-12.4.bin")
|
||||||
|
|
||||||
|
if os.path.isfile(iou_path):
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
def iou(request):
|
def iou(request):
|
||||||
|
|
||||||
@ -14,8 +24,7 @@ def iou(request):
|
|||||||
return iou_device
|
return iou_device
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(os.environ["TRAVIS"] == 'true',
|
@pytest.mark.skipif(no_iou(), reason="IOU Image not available")
|
||||||
reason="IOU Image not available on Travis")
|
|
||||||
def test_iou_is_started(iou):
|
def test_iou_is_started(iou):
|
||||||
|
|
||||||
print(iou.command())
|
print(iou.command())
|
||||||
@ -23,8 +32,7 @@ def test_iou_is_started(iou):
|
|||||||
assert iou.is_running()
|
assert iou.is_running()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(os.environ["TRAVIS"] == 'true',
|
@pytest.mark.skipif(no_iou(), reason="IOU Image not available")
|
||||||
reason="IOU Image not available on Travis")
|
|
||||||
def test_iou_restart(iou):
|
def test_iou_restart(iou):
|
||||||
|
|
||||||
iou.stop()
|
iou.stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user