Fix stacklight-pytest install
Install stacklight-pytest into virtualenv to not broke system
libraries.
Change-Id: I89f9f00a2aacb1c86d7bbc7c047527b963f90024
diff --git a/tcp_tests/managers/sl_manager.py b/tcp_tests/managers/sl_manager.py
index 4eb6228..a1ee3a7 100644
--- a/tcp_tests/managers/sl_manager.py
+++ b/tcp_tests/managers/sl_manager.py
@@ -93,15 +93,14 @@
target_node_name = [node_name for node_name
in self.__underlay.node_names()
if node_to_run in node_name]
- if skip_tests:
- cmd = ("cd {0}; "
- "export VOLUME_STATUS='available'; "
- "pytest -k 'not {1}' {2}".format(
- tests_path, skip_tests, test_to_run))
- else:
- cmd = ("cd {0}; "
- "export VOLUME_STATUS='available'; "
- "pytest -k {1}".format(tests_path, test_to_run))
+ cmd = ("cd {0}; "
+ ". venv-stacklight-pytest/bin/activate;"
+ "export VOLUME_STATUS='available';"
+ "pytest -k {1} {2}".format(
+ tests_path,
+ "'not " + skip_tests + "'" if skip_tests else '',
+ test_to_run))
+
with self.__underlay.remote(node_name=target_node_name[0]) \
as node_remote:
LOG.debug("Run {0} on the node {1}".format(
@@ -115,21 +114,19 @@
target_node_name = [node_name for node_name
in self.__underlay.node_names()
if node_to_run in node_name]
- if skip_tests:
- cmd = ("cd {0}; "
- "export VOLUME_STATUS='available'; "
- "pytest --json=report.json -k 'not {1}' {2}".format(
- tests_path, skip_tests, test_to_run))
- else:
- cmd = ("cd {0}; "
- "export VOLUME_STATUS='available'; "
- "pytest --json=report.json -k {1}".format(
- tests_path, test_to_run))
+ cmd = ("cd {0}; "
+ ". venv-stacklight-pytest/bin/activate;"
+ "export VOLUME_STATUS='available';"
+ "pip install pytest-json;"
+ "pytest --json=report.json -k {1} {2}".format(
+ tests_path,
+ "'not " + skip_tests + "'" if skip_tests else '',
+ test_to_run))
+
with self.__underlay.remote(node_name=target_node_name[0]) \
as node_remote:
LOG.debug("Run {0} on the node {1}".format(
cmd, target_node_name[0]))
- node_remote.execute('pip install pytest-json')
node_remote.execute(cmd)
res = node_remote.execute('cd {0}; cat report.json'.format(
tests_path))