[mousetrap] Use correct python version for `make check` and `make coverage`



commit 5d8ffe8da378179951e9f8d4fa227eea439043c8
Author: Stoney Jackson <dr stoney gmail com>
Date:   Tue Jun 16 13:44:06 2015 -0400

    Use correct python version for `make check` and `make coverage`
    
    Before, `make check` did one of two things:
    
    1) It ran the tests indirectly using `coverage`.
    2) It ran the tests directly.
    
    It did the first if `coverage` was available, otherwise it did
    the second.
    
    The problem was that `coverage` always used python2, whereas the
    second used whatever python version was specified when autogen.sh
    was run. This gave inconsistant test results.
    
    This commit simplifies `make check` so that it always runs the
    tests directly using the version of python specified with
    autogen.sh.
    
    The call to coverage is now isolated to `make coverage`. Also,
    coverage is called using a specific python version: the version
    specified with autogen.sh.
    
    This should give more consistent results.
    
    Closes bug 751066

 Makefile.am |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a5671cb..7d7ad49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -124,25 +124,21 @@ MT_BUILD_HOME = $(shell dirname $(shell find "$(builddir)/build" -mindepth 2 -ma
 MT_BUILD_TESTS = $(shell find "$(MT_BUILD_HOME)/mousetrap" -name "run_python_tests.py")
 
 check-local:
-       if command -v coverage >/dev/null 2>&1 ; then \
-               PYTHONPATH="$(MT_BUILD_HOME)" \
-                       coverage run \
-                               --branch \
-                               --source="$(MT_BUILD_HOME)" \
-                               --omit="*/__init__.py","*/test_*.py","*/run_python_tests.py" \
-                               "$(MT_BUILD_TESTS)"; \
-               exit $$?; \
-       else \
-               PYTHONPATH="$(MT_BUILD_HOME)" \
-                       "$(PYTHON)" "$(MT_BUILD_TESTS)"; \
-               exit $$?; \
-       fi
+       PYTHONPATH="$(MT_BUILD_HOME)" \
+               "$(PYTHON)" "$(MT_BUILD_TESTS)"; \
+       exit $$?;
 
 
 ##############################################################################
 # TARGET: coverage
 
 coverage:
+       PYTHONPATH="$(MT_BUILD_HOME)" \
+               "$(PYTHON)" "`which coverage`" run \
+                       --branch \
+                       --source="$(MT_BUILD_HOME)" \
+                       --omit="*/__init__.py","*/test_*.py","*/run_python_tests.py" \
+                       "$(MT_BUILD_TESTS)"; \
        bin/coverage.bash
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]