[master 1/1] update Makefile to be able to execute the test suite for both Python 2 and 3 and check if required dependencies are installed

atodorov installerbot-noreply at redhat.com
Fri Jun 5 13:06:11 UTC 2015


From: Alexander Todorov <atodorov at redhat.com>

---
 Makefile | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index a55f500..96abf1e 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,11 @@ 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
 
@@ -26,17 +31,26 @@ po-empty:
 		exit 1 ; \
 	done
 
-test:
-	@echo "*** Running unittests ***"
+check-requires:
+	@echo "*** Checking if the dependencies required for testing and analysis are available ***"
+	@grep "^Requires:" python-blivet.spec | cut -f2 -d: | cut -f1 -d">" | xargs rpm -q
+	@rpm -q python-mock python3-mock
+	@rpm -q cryptsetup-python cryptsetup-python3
+	@rpm -q python3-gobject
+	@rpm -q python-coverage python3-coverage
+	@rpm -q xfsprogs hfsplus-tools
+	@rpm -q python3-pocketlint
+
+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: 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/*"
 
-check:
+check: check-requires
 	PYTHONPATH=. tests/pylint/runpylint.py
 
 clean:


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/e2ca130a52d5bad6a5d52a83f71df8db2d893d92


More information about the anaconda-patches mailing list