mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 08:18:30 +00: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
|
||||
import time
|
||||
import os
|
||||
import pytest
|
||||
|
||||
|
||||
def test_is_started(hypervisor):
|
||||
@ -37,6 +38,6 @@ def test_stdout():
|
||||
hypervisor = Hypervisor(dynamips_path, "/tmp", "127.0.0.1", 7200)
|
||||
hypervisor.start()
|
||||
# give some time for Dynamips to start
|
||||
time.sleep(0.01)
|
||||
time.sleep(0.1)
|
||||
output = hypervisor.read_stdout()
|
||||
assert output
|
||||
|
@ -3,6 +3,16 @@ import os
|
||||
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")
|
||||
def iou(request):
|
||||
|
||||
@ -14,8 +24,7 @@ def iou(request):
|
||||
return iou_device
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.environ["TRAVIS"] == 'true',
|
||||
reason="IOU Image not available on Travis")
|
||||
@pytest.mark.skipif(no_iou(), reason="IOU Image not available")
|
||||
def test_iou_is_started(iou):
|
||||
|
||||
print(iou.command())
|
||||
@ -23,8 +32,7 @@ def test_iou_is_started(iou):
|
||||
assert iou.is_running()
|
||||
|
||||
|
||||
@pytest.mark.skipif(os.environ["TRAVIS"] == 'true',
|
||||
reason="IOU Image not available on Travis")
|
||||
@pytest.mark.skipif(no_iou(), reason="IOU Image not available")
|
||||
def test_iou_restart(iou):
|
||||
|
||||
iou.stop()
|
||||
|
Loading…
Reference in New Issue
Block a user