Tox should be installed in the virtual environment to isolate your
environment from the host. Add section on creating and using the virtual
environment base.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
README.dev | 59 +++++++++++++++++++++++++++---------------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/README.dev b/README.dev
index 46b0088..bf0f2e4 100644
--- a/README.dev
+++ b/README.dev
@@ -3,27 +3,50 @@ Prerequisites
For Fedora/CentOS install the following packages:
$ sudo yum install -y gcc make libaio-devel libblkid-devel libuuid-devel
For Ubuntu/Debian install the following packages:
$ sudo apt install -y gcc make libaio-dev libblkid-dev uuid-dev
-How to test sanlock
-===================
+Creating and using the virtual environment
+==========================================
-To run the python based tests, you need tox. The best way to install a
-recent version is to use pip:
+To run the python based tests, you need the python packages listed in
+`requirements.txt`. The best way to install a recent version is to use a python
+virtual environment (
https://docs.python.org/3/library/venv.html).
- $ pip install tox
+To create the virtual environment:
+
+ $ python3 -m venv ~/.venv/sanlock
+ $ source ~/.venv/sanlock/bin/activate
+ $ pip install --upgrade pip
+ $ pip install -r requirements.txt
+ $ deactivate
+
+Before running the tests, you need to activate the virtual environment:
+
+ $ source ~/.venv/sanlock/bin/activate
+
+The shell prompt will change to show the virtual environment name:
+
+ (sanlock) [user@hostname sanlock]$
+
+To deactivate the virtual environment:
+
+ $ deactivate
+
+
+Running the python tests
+========================
To run the tests with python 2.7 and 3.6:
$ tox
Note: python 3.6 tests will fail now, since sanlock extension module needs
changes to compile on python 3.
To run only python 2.7:
@@ -47,51 +70,27 @@ enable it using:
$ tox -e py36 tests/python_test.py -- -vv
Or using environment variable:
export PYTEST_ADDOPTS=-vv
Testing 4K support
==================
-To enable the 4k tests, you need to have userstorage installed.
-First, you need to create a virtual environment
-(https://docs.python.org/3/library/venv.html), and then install
-the userstorage library from the requirements.txt.
-This only needs to be done once:
-
- $ python3 -m venv ~/.venv/sanlock
- $ source ~/.venv/sanlock/bin/activate
- $ pip install --upgrade pip
- $ pip install -r requirements.txt
- $ deactivate
-
-Before running the tests, you need to enter the virtual environment:
-
- $ source ~/.venv/sanlock/bin/activate
-
-The shell prompt will change to show the virtual environment name:
-
- (sanlock) [user@hostname sanlock]$
-
-Then, you just need to setup 4k storage for the tests:
+To enable the 4k tests, you need to create userstorage for the tests:
$ userstorage create tests/storage.py
This creates two loop devices with 4k sector size; one for testing sanlock with
4k block device, and the other for testing with a filesystem backed by a 4k
block device.
To teardown the storage:
$ userstorage delete tests/storage.py
The script unmounts the filesystem and detaches the loop devices.
The storage helper script uses sudo to perform privileged operations. The best
way to use it is to setup the environment once at the start of the session, and
teardown when you finish.
-
-To deactivate the virtual environment:
-
- $ deactivate
--
2.38.1