1
0
mirror of https://github.com/rancher/os.git synced 2025-09-17 23:48:09 +00:00

migrate to python-3.4

This commit is contained in:
Ivan Mikushin
2015-05-08 10:42:18 +05:00
parent 72b29cc797
commit f2d797d6cc
5 changed files with 13 additions and 10 deletions

View File

@@ -3,6 +3,6 @@ import pytest
@pytest.fixture(scope="session", autouse=True)
def my_own_session_run_at_beginning():
def chdir_to_project_root():
os.chdir('../..')
print('\nChdir to project root dir')

View File

@@ -1,12 +1,11 @@
import pytest
import string
import subprocess
import time
@pytest.fixture(scope="module")
def qemu(request):
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
p = subprocess.Popen('./scripts/run', stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
def fin():
print('\nTerminating QEMU')
@@ -20,8 +19,8 @@ def qemu(request):
@pytest.mark.timeout(20)
def test_system_boot(qemu):
for ln in iter(qemu.stdout.readline, ''):
ros_booted_substr = string.find(ln, 'RancherOS v0.3.1-rc2 started')
print(string.strip(ln))
ros_booted_substr = str.find(ln, 'RancherOS v0.3.1-rc2 started') # TODO use ./scripts/version
print(str.strip(ln))
if ros_booted_substr > -1:
assert True
return
@@ -31,14 +30,14 @@ def test_system_boot(qemu):
@pytest.mark.timeout(40)
def test_run_system_container(qemu):
assert qemu.returncode is None
time.sleep(1) # or else ssh will fail (WTF?!)
time.sleep(2) # or else ssh will fail (WTF?!)
ssh = subprocess.Popen(
'./scripts/ssh sudo system-docker run --rm busybox /bin/true', shell=True,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
try:
for ln in iter(ssh.stdout.readline, ''):
print(string.strip(ln))
print(str.strip(ln))
pass
ssh.wait()
assert ssh.returncode == 0