From: Mark Syms <mark.syms@citrix.com>
Date: Mon, 29 Jan 2018 09:46:45 +0000
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 <mark.syms@citrix.com>
---
 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 0000000..76b5fc6
--- /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 0000000..2cff46a
--- /dev/null
+++ b/dev_requirements.txt
@@ -0,0 +1,2 @@
+nose
+-r base_requirements.txt
diff --git a/requirements.txt b/requirements.txt
index 4aca9c0..bddba47 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 b46f638..191b6f5 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 9eb47b5..3834c69 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
+
+
-- 
1.8.3.1

