1
0
mirror of https://github.com/rancher/os.git synced 2025-08-09 10:38:25 +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

2
.gitignore vendored
View File

@ -8,5 +8,5 @@
*.swp *.swp
Dockerfile Dockerfile
/tests/integration/MANIFEST /tests/integration/MANIFEST
/tests/integration/.venv /tests/integration/.venv*
/tests/integration/.tox /tests/integration/.tox

View File

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

View File

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

View File

@ -1,4 +1,8 @@
flake8==2.4.0 flake8==2.4.0
mccabe==0.3
pep8==1.6.2
py==1.4.27
pyflakes==0.8.1
pytest==2.7.0 pytest==2.7.0
pytest-timeout==0.4 pytest-timeout==0.4
tox==1.9.2 tox==1.9.2

View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist=flake8, py27 envlist=flake8, py34
[testenv] [testenv]
deps=-rrequirements.txt deps=-rrequirements.txt