Skip to content

Commit

Permalink
Merge pull request #151 from mulkieran/master-120
Browse files Browse the repository at this point in the history
Parameterize Makefile test targets on Python version.
  • Loading branch information
mulkieran committed Jun 9, 2015
2 parents 053fc41 + 862e29f commit 40a2d5b
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,25 @@ 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
TEST_DEPENDENCIES := $(shell echo $(sort $(TEST_DEPENDENCIES)) | uniq)

all:
$(MAKE) -C po

Expand All @@ -26,17 +40,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 $(TEST_DEPENDENCIES) | 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:
Expand Down

0 comments on commit 40a2d5b

Please sign in to comment.