[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
Thu Jun 4 09:14:01 UTC 2015


From: Alexander Todorov <atodorov at redhat.com>

---
 Makefile | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index a55f500..6dece47 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,14 +31,25 @@ po-empty:
 		exit 1 ; \
 	done
 
-test:
-	@echo "*** Running unittests ***"
+check-requires:
+	@echo "*** Checking if required dependencies are installed ***"
+	@grep Requires: python-blivet.spec | grep -v "Add Requires"  | cut -f2 -d: | \
+	cut -f1 -d">" | tr -s ',' ' ' | xargs rpm -q
+	@rpm -q python-mock python3-mock
+	@rpm -q python-pyblock
+	@rpm -q cryptsetup-python cryptsetup-python3
+	@rpm -q python3-gobject
+	@rpm -q python-coverage python3-coverage
+	@rpm -q python-bugzilla python3-bugzilla
+	@rpm -q xfsprogs hfsplus-tools
+
+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:


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


More information about the anaconda-patches mailing list