fix docker tests and print output for python3

This commit is contained in:
cglewis 2021-01-17 12:39:21 -08:00
parent a394673993
commit 8533f7ef3f
2 changed files with 10 additions and 10 deletions

View File

@ -35,7 +35,7 @@ LOG = logging.getLogger(__name__)
DOCKER_IMAGE_MININET = 'osrg/ryu-book' DOCKER_IMAGE_MININET = 'osrg/ryu-book'
OVSDB_MANAGER_ADDR = 'ptcp:6640' OVSDB_MANAGER_ADDR = 'ptcp:6640'
OVSDB_SWITCH_ADDR = 'tcp:%s:6640' OVSDB_SWITCH_ADDR = 'tcp:0.0.0.0:6640'
def setUpModule(): def setUpModule():
@ -93,7 +93,7 @@ class TestVSCtl(unittest.TestCase):
@classmethod @classmethod
def _docker_run(cls, image): def _docker_run(cls, image):
return _run('docker run --privileged -t -d %s' % image)[0] return _run('docker run --privileged -t -d -p 6640:6640 %s' % image)[0]
@classmethod @classmethod
def _docker_stop(cls, container): def _docker_stop(cls, container):
@ -124,7 +124,7 @@ class TestVSCtl(unittest.TestCase):
@classmethod @classmethod
def _set_up_vsctl(cls): def _set_up_vsctl(cls):
cls.vsctl = vsctl.VSCtl(OVSDB_SWITCH_ADDR % cls.container_mn_ip) cls.vsctl = vsctl.VSCtl(OVSDB_SWITCH_ADDR)
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):

View File

@ -70,29 +70,29 @@ def check_dependencies():
if not HAS_VIRTUALENV: if not HAS_VIRTUALENV:
raise Exception('Virtualenv not found. ' + \ raise Exception('Virtualenv not found. ' + \
'Try installing python-virtualenv') 'Try installing python-virtualenv')
print 'done.' print('done.') # pylint: disable=print-statement
def create_virtualenv(venv=VENV, install_pip=False): def create_virtualenv(venv=VENV, install_pip=False):
"""Creates the virtual environment and installs PIP only into the """Creates the virtual environment and installs PIP only into the
virtual environment virtual environment
""" """
print 'Creating venv...', print('Creating venv...') # pylint: disable=print-statement
install = ['virtualenv', '-q', venv] install = ['virtualenv', '-q', venv]
run_command(install) run_command(install)
print 'done.' print('done.') # pylint: disable=print-statement
print 'Installing pip in virtualenv...', print('Installing pip in virtualenv...') # pylint: disable=print-statement
if install_pip and \ if install_pip and \
not run_command(['tools/with_venv.sh', 'easy_install', not run_command(['tools/with_venv.sh', 'easy_install',
'pip>1.0']): 'pip>1.0']):
die("Failed to install pip.") die("Failed to install pip.")
print 'done.' print('done.') # pylint: disable=print-statement
def install_dependencies(venv=VENV): def install_dependencies(venv=VENV):
print 'Installing dependencies with pip (this can take a while)...' print('Installing dependencies with pip (this can take a while)...') # pylint: disable=print-statement
run_command(['tools/with_venv.sh', 'pip', 'install', '-r', run_command(['tools/with_venv.sh', 'pip', 'install', '-r',
PIP_REQUIRES], redirect_output=False) PIP_REQUIRES], redirect_output=False)
run_command(['tools/with_venv.sh', 'pip', 'install', '-r', run_command(['tools/with_venv.sh', 'pip', 'install', '-r',
@ -126,7 +126,7 @@ def print_help():
Also, make test will automatically use the virtualenv. Also, make test will automatically use the virtualenv.
""" """
print help print(help) # pylint: disable=print-statement
def main(argv): def main(argv):