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

atodorov installerbot-noreply at redhat.com
Wed May 27 11:11:13 UTC 2015


From: Alexander Todorov <atodorov at redhat.com>

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

diff --git a/Makefile b/Makefile
index a55f500..c133a32 100644
--- a/Makefile
+++ b/Makefile
@@ -26,16 +26,37 @@ po-empty:
 		exit 1 ; \
 	done
 
-test:
-	@echo "*** Running unittests ***"
-	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 ***"
+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
+
+test-python2: check-requires
+	@echo "*** Running unittests with Python 2 ***"
+	PYTHONPATH=.:tests/ python2 -m unittest discover -v -s tests/ -p '*_test.py'
+
+test-python3: check-requires
+	@echo "*** Running unittests with Python 3 ***"
+	PYTHONPATH=.:tests/ python3 -m unittest discover -v -s tests/ -p '*_test.py'
+
+test: test-python2 test-python3
+
+coverage-python2: check-requires
+	@echo "*** Running unittests with coverage for Python 2 ***"
 	PYTHONPATH=.:tests/ coverage run --branch -m unittest discover -v -s tests/ -p '*_test.py'
 	coverage report --include="blivet/*"
 
+coverage-python3: check-requires
+	@echo "*** Running unittests with coverage for Python 3 ***"
+	PYTHONPATH=.:tests/ coverage3 run --branch -m unittest discover -v -s tests/ -p '*_test.py'
+	coverage3 report --include="blivet/*"
+
 check:
 	PYTHONPATH=. tests/pylint/runpylint.py
 


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


More information about the anaconda-patches mailing list