From 8112be268a281965c5b543ff5e5ef35a20d9bad6 Mon Sep 17 00:00:00 2001 From: Mark Syms Date: Mon, 29 Jan 2018 09:46:45 +0000 Subject: [PATCH] Rationalise installation of pip packages as much as possible Ensure that unit tests use virtualenv when not in RPM build. Signed-off-by: Mark Syms Reviewed-by: Chandrika Srinivasan --- base_requirements.txt | 6 ++++++ dev_requirements.txt | 2 ++ requirements.txt | 7 +------ tests/run_python_unittests.sh | 2 +- tests/setup_env_for_python_unittests.sh | 7 +++---- 5 files changed, 13 insertions(+), 11 deletions(-) create mode 100644 base_requirements.txt create mode 100644 dev_requirements.txt diff --git a/base_requirements.txt b/base_requirements.txt new file mode 100644 index 000000000..76b5fc67d --- /dev/null +++ b/base_requirements.txt @@ -0,0 +1,6 @@ +mock +xenapi +coverage +astroid==1.4.9 +pylint==1.5 +bitarray diff --git a/dev_requirements.txt b/dev_requirements.txt new file mode 100644 index 000000000..2cff46a70 --- /dev/null +++ b/dev_requirements.txt @@ -0,0 +1,2 @@ +nose +-r base_requirements.txt diff --git a/requirements.txt b/requirements.txt index 4aca9c081..bddba4720 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,2 @@ -mock -xenapi +-r base_requirements.txt coveralls -coverage -astroid==1.4.9 -pylint==1.5 -bitarray diff --git a/tests/run_python_unittests.sh b/tests/run_python_unittests.sh index b46f6380f..191b6f54c 100755 --- a/tests/run_python_unittests.sh +++ b/tests/run_python_unittests.sh @@ -4,7 +4,7 @@ set -eu SMROOT=$(cd $(dirname $0) && cd .. && pwd) -if [ ! -x "$(command -v nosetests)" ] || [ ! -x "$(command -v coverage)" ]; then +if [ ! -v RPM_BUILD_ROOT ]; then echo "Activating virtual env" ENVDIR="$SMROOT/.env" diff --git a/tests/setup_env_for_python_unittests.sh b/tests/setup_env_for_python_unittests.sh index 9eb47b5d6..3834c692c 100755 --- a/tests/setup_env_for_python_unittests.sh +++ b/tests/setup_env_for_python_unittests.sh @@ -15,7 +15,6 @@ pip install six pip install packaging pip install appdirs pip install --upgrade setuptools -pip install nose -pip install coverage -pip install mock==1.0.1 -pip install bitarray +pip install -r $SMROOT/dev_requirements.txt + +