[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sanlock-devel
Subject:    [sanlock] branch master updated: tox: Make it easy to run the tests
From:       git () pagure ! io (git repository hosting)
Date:       2018-11-26 14:59:56
Message-ID: 20181126145956.4553.11092 () pagure01 ! fedoraproject ! org
[Download RAW message or body]

This is an automated email from the git hooks/post-receive script.

teigland pushed a commit to branch master
in repository sanlock.

The following commit(s) were added to refs/heads/master by this push:
     new 7cab627  tox: Make it easy to run the tests
7cab627 is described below

commit 7cab6271642286fc3bb65cd3d259aa0e2c777cda
Author: Nir Soffer <nsoffer@redhat.com>
AuthorDate: Mon Nov 26 02:11:20 2018 +0200

    tox: Make it easy to run the tests
    
    tox make it easy to run python tests with multiple versions of python.
    
    To run all python tests:
    
        $ tox
    
    This command:
    - sets environment variables for the test, without modifying your shell
    - creates python virtual environment for python 2.7 and python 3.6 if
      needed.
    - installs the test dependencies in the virtual environment without
      modifying system python.
    - builds wdmd, sanlock and the python module
    - runs the tests with both python versions
    
    Note: python 3.6 fails now because the python module does not compile
    yet on python 3.
    
    To run only the python 2.7 tests:
    
        $ tox -e py27
    
    README.dev was simplified; there is not need now to install pytest,
    run make, or set environment variables.
    
    pytest.ini was merged into tox.ini.
    
    Signed-off-by: Nir Soffer <nsoffer@redhat.com>
---
 README.dev | 27 +++++++++++++++------------
 pytest.ini |  7 -------
 tox.ini    | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 19 deletions(-)

diff --git a/README.dev b/README.dev
index 04fbb02..3519993 100644
--- a/README.dev
+++ b/README.dev
@@ -1,23 +1,26 @@
 How to test sanlock
 ===================
 
-To run the python based tests, you need pytest. The best way to install a
+To run the python based tests, you need tox. The best way to install a
 recent version is to use pip:
 
-    $ pip install pytest
+    $ pip install tox
 
-Before running the tests, you need to build wdmd, sanlock, and sanlock
-python bindings:
+To run the tests with python 2.7 and 3.6:
 
-    $ make -C wdmd
-    $ make -C src
-    $ make -C python inplace
+    $ tox
 
-Setup the environment for testing sanlock running sanlcok from source as
-current user:
+Note: python 3.6 tests will fail now, since sanlock extension module needs
+changes to compile on python 3.
 
-    $ source tests/env.sh
+To run only python 2.7:
 
-To run the tests:
+    $ tox -e py27
 
-    $ pytest
+To run only test from some modules:
+
+    $ tox tests/daemon_test.py
+
+To run only tests matching the substring "foo":
+
+    $ tox -- -k foo
diff --git a/pytest.ini b/pytest.ini
deleted file mode 100644
index bb17bd5..0000000
--- a/pytest.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[pytest]
-# Notes:
-# --basetemp: we must use /var/tmp as sanlock uses direct I/O.
-# -vv: increasing verbosify twice shows more detailed failures tracebacks.
-# -rxs: show extra test summary: (s)skipped, (x)failed
-# --durations: show slowest test duration
-addopts = -rxs -vv --basetemp=/var/tmp/sanlock --durations=10
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..ae9c8a7
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,34 @@
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py27,py36
+skipsdist = True
+skip_missing_interpreters = True
+
+[testenv]
+passenv = USER
+setenv =
+    LD_LIBRARY_PATH={env:PWD}/wdmd:{env:PWD}/src
+    SANLOCK_PRIVILEGED=0
+    SANLOCK_RUN_DIR=/tmp/sanlock
+    PYTHONPATH={env:PWD}/python
+sitepackages = True
+whitelist_externals = make
+deps =
+    pytest==4.0
+commands =
+    make -C wdmd
+    make -C src
+    make -C python inplace
+    pytest {posargs}
+
+[pytest]
+# Notes:
+# --basetemp: we must use /var/tmp as sanlock uses direct I/O.
+# -vv: increasing verbosify twice shows more detailed failures tracebacks.
+# -rxs: show extra test summary: (s)skipped, (x)failed
+# --durations: show slowest test duration
+addopts = -rxs -vv --basetemp=/var/tmp/sanlock --durations=10

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
sanlock-devel mailing list -- sanlock-devel@lists.fedorahosted.org
To unsubscribe send an email to sanlock-devel-leave@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedorahosted.org/archives/list/sanlock-devel@lists.fedorahosted.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic