Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ REQUEST=`if test -n "$$PR"; then echo ".PR$${PR}"; elif test -n "$$MR"; then ech
# 1.201810080027Z.4078402.master
RELEASE="$(N_REL).$(TIMESTAMP).$(SHORT_SHA).$(BRANCH)$(REQUEST)$(_SUFFIX)"

ifneq ($(shell id -u),0)
ENTER_VENV := . $(VENVNAME)/bin/activate;
else
ENTER_VENV :=
endif

all: help

help:
Expand Down Expand Up @@ -134,21 +140,29 @@ container-test:
docker run --rm -ti -v ${PWD}:/payload leapp-tests

test: lint
ifeq ($(shell id -u), 0)
pytest -vv --cov-report term-missing --cov=leapp tests/scripts
else
. $(VENVNAME)/bin/activate ; \
@ $(ENTER_VENV) \
pytest -vv --cov-report term-missing --cov=leapp tests/scripts
endif

lint:
ifeq ($(shell id -u), 0)
@ $(ENTER_VENV) \
pytest --cache-clear --pylint -m pylint leapp tests/scripts/*.py; \
pytest --cache-clear --flake8 -m flake8 leapp tests/scripts/*.py
else
. $(VENVNAME)/bin/activate ; \
pytest --cache-clear --pylint -m pylint leapp tests/scripts/*.py; \
pytest --cache-clear --flake8 -m flake8 leapp tests/scripts/*.py
endif

.PHONY: clean copr_build install install-deps install-test srpm test lint
fast_lint:
@ $(ENTER_VENV) \
FILES_TO_LINT="$$(git diff --name-only $(MASTER_BRANCH)| grep '\.py$$')"; \
if [[ -n "$$FILES_TO_LINT" ]]; then \
pylint -j 0 $$FILES_TO_LINT && \
flake8 $$FILES_TO_LINT; \
LINT_EXIT_CODE="$$?"; \
if [[ "$$LINT_EXIT_CODE" != "0" ]]; then \
exit $$LINT_EXIT_CODE; \
fi; \
if [[ "$(_PYTHON_VENV)" == "python2.7" ]] ; then \
pylint --py3k $$FILES_TO_LINT; \
fi; \
else \
echo "No files to lint."; \
fi

.PHONY: clean copr_build install install-deps install-test srpm test lint fast_lint