[master 1/1] Parameterize Makefile test targets on Python version.
mulkieran
installerbot-noreply at redhat.com
Mon Jun 8 20:49:20 UTC 2015
From: Alexander Todorov <atodorov at redhat.com>
Check that dependencies for testing are available.
---
Makefile | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/Makefile b/Makefile
index 823b948..2e888e9 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,24 @@ RELEASE_TAG=$(PKGNAME)-$(VERSION)-$(RELEASE)
VERSION_TAG=$(PKGNAME)-$(VERSION)
PYTHON=python2
+COVERAGE=coverage
+ifeq ($(PYTHON),python3)
+ COVERAGE=coverage3
+endif
+
ZANATA_PULL_ARGS = --transdir ./po/
ZANATA_PUSH_ARGS = --srcdir ./po/ --push-type source --force
MOCKCHROOT ?= fedora-rawhide-x86_64
+TEST_DEPENDENCIES = $(shell grep "^Requires:" python-blivet.spec | cut -f2 -d: | cut -f1 -d">")
+TEST_DEPENDENCIES += python-mock python3-mock
+TEST_DEPENDENCIES += cryptsetup-python cryptsetup-python3
+TEST_DEPENDENCIES += python3-gobject
+TEST_DEPENDENCIES += python-coverage python3-coverage
+TEST_DEPENDENCIES += xfsprogs hfsplus-tools
+TEST_DEPENDENCIES += python3-pocketlint
+
all:
$(MAKE) -C po
@@ -26,17 +39,20 @@ po-empty:
exit 1 ; \
done
-test:
- @echo "*** Running unittests ***"
+check-requires:
+ @echo "*** Checking if the dependencies required for testing and analysis are available ***"
+ @echo $(sort $(TEST_DEPENDENCIES)) | uniq | xargs rpm -q
+
+test: check-requires
+ @echo "*** Running unittests with $(PYTHON) ***"
PYTHONPATH=.:tests/ $(PYTHON) -m unittest discover -v -s tests/ -p '*_test.py'
-coverage:
- @which coverage || (echo "*** Please install python-coverage ***"; exit 2)
- @echo "*** Running unittests with coverage ***"
- PYTHONPATH=.:tests/ coverage run --branch -m unittest discover -v -s tests/ -p '*_test.py'
- coverage report --include="blivet/*"
+coverage: check-requires
+ @echo "*** Running unittests with $(COVERAGE) for $(PYTHON) ***"
+ PYTHONPATH=.:tests/ $(COVERAGE) run --branch -m unittest discover -v -s tests/ -p '*_test.py'
+ $(COVERAGE) report --include="blivet/*" --show-missing
-check:
+check: check-requires
PYTHONPATH=. tests/pylint/runpylint.py
clean:
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/0945e13578e95ca3fbf77c1554937beab5d37ec8
More information about the anaconda-patches
mailing list