Module: check_mk
Branch: master
Commit: 4fa2e642264c4e8b9e4cf622a6397f8b4fd27f3c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4fa2e642264c4e…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Tue Nov 13 13:40:25 2018 +0100
Cosmectic cleanup only.
Change-Id: I7cd9db3b430a276aeacd02d4fcef1f5a3975c915
---
tests/Makefile | 91 ++++++++++++++++++++++++++++++----------------------------
1 file changed, 47 insertions(+), 44 deletions(-)
diff --git a/tests/Makefile b/tests/Makefile
index 96cf581..13c6e6f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,77 +1,74 @@
SHELL := /bin/bash -e
+VENV := ../.venv
PIPENV := PIPENV_VENV_IN_PROJECT=true pipenv
-PYTEST := $(PIPENV) run py.test -s -vv
-COVERAGE := $(PIPENV) run coverage
BANDIT := $(PIPENV) run bandit
+COVERAGE := $(PIPENV) run coverage
+PYTEST := $(PIPENV) run py.test -s -vv
+YAPF := $(PIPENV) run yapf
-.PHONY: help pipenv-check test-unit test-unit-coverage-html test-integration \
- test-gui-crawl test-pylint test-packaging test-docker test-bandit \
- test-shellcheck
+.PHONY: help pipenv-check test-bandit test-docker test-format-python \
+ test-gui-crawl test-integration test-packaging test-pylint \
+ test-shellcheck test-unit test-unit-coverage-html
help:
- @echo "setup - Install dependencies"
- @echo "test-unit - Run unit tests"
- @echo "test-unit-coverage-html - Create HTML coverage report for unit
tests"
- @echo "test-integration - Run integration tests"
- @echo "test-gui-crawl - Run GUI crawl test"
- @echo "test-pylint - Run pylint based tests"
- @echo "test-packaging - Run packaging tests"
+ echo $(MAKE) -C $(dir $(VENV)) $(notdir $(VENV))
+ @echo "pipenv-check - Checks for security vulnerabilities/PEP 508
markers"
@echo "test-bandit - Run bandit (security) tests"
- @echo "test-shellcheck - Run shellcheck tests"
@echo "test-docker - Run docker tests"
@echo "test-format-python - Test the python formatting"
+ @echo "test-gui-crawl - Run GUI crawl test"
+ @echo "test-integration - Run integration tests"
+ @echo "test-packaging - Run packaging tests"
+ @echo "test-pylint - Run pylint based tests"
+ @echo "test-shellcheck - Run shellcheck tests"
+ @echo "test-unit - Run unit tests"
+ @echo "test-unit-coverage-html - Create HTML coverage report for unit
tests"
-# This target needs to be phony so it is run every time because only the other
+# These target need to be phony so it is run every time because only the other
# makefile can determine that there's nothing to be done.
# TODO: Move everything to top level makefile?
-.PHONY: ../.venv bandit.ini test-format-python
+.PHONY: $(VENV) bandit.ini
+
+$(VENV):
+ $(MAKE) -C $(dir $(VENV)) $(notdir $(VENV))
-../.venv:
- $(MAKE) -C .. .venv
+bandit.ini:
+ echo -e "[bandit]\ntargets: $$(./find-python-files | tr '\n' ',' |
sed 's/,$$//')" > bandit.ini
-pipenv-check: ../.venv
+pipenv-check: $(VENV)
$(PIPENV) check
-test-format-python: ../.venv
+test-bandit: $(VENV) bandit.ini
+# Currently only care about high severity reported issues. Once this is reached,
+# go and enable the medium/low checks.
+ $(BANDIT) -c ../bandit.yaml -r -lll --ini bandit.ini $(BANDIT_OUTPUT_ARGS)
+
+test-docker: $(VENV)
+ $(MAKE) -C ../docker test-lint-dockerfile test-lint-entrypoint
+ $(PYTEST) -T docker
+
+test-format-python: $(VENV) ../.style.yapf
# Explicitly specify --style [FILE] to prevent costly searching in parent directories
# for each file specified via command line
#
# Saw some mixed up lines on stdout after adding the --parallel option. Leaving it on
# for the moment to get the performance boost this option brings.
PYTHON_FILES=$${PYTHON_FILES-$$(./find-python-files)} ; \
- $(PIPENV) run yapf --parallel --style ../.style.yapf --verbose --diff $$PYTHON_FILES \
+ $(YAPF) --parallel --style ../.style.yapf --verbose --diff $$PYTHON_FILES \
| grep -e "^Reformatting " -e "(reformatted)$$" \
| awk '{if ($$1 == "+++") { print "Unformatted: "$$2 } else
{print "Checking "$$2"..."}}' ; exit $${PIPESTATUS[0]}
-test-unit: ../.venv
- $(PYTEST) -T unit
-
-test-unit-coverage-html: ../.venv
- $(COVERAGE) run --rcfile=.coveragerc_unit -m pytest -T unit ; $(COVERAGE) html
-
-test-integration: ../.venv
- $(PYTEST) -T integration
-
-test-gui-crawl: ../.venv
+test-gui-crawl: $(VENV)
$(PYTEST) -T gui_crawl
-test-pylint: ../.venv
- $(PYTEST) -T pylint
+test-integration: $(VENV)
+ $(PYTEST) -T integration
-test-packaging: ../.venv
+test-packaging: $(VENV)
$(PYTEST) -T packaging
-test-docker: ../.venv
- $(MAKE) -C ../docker test-lint-dockerfile test-lint-entrypoint
- $(PYTEST) -T docker
-
-bandit.ini:
- echo -e "[bandit]\ntargets: $$(./find-python-files | tr '\n' ',' |
sed 's/,$$//')" > bandit.ini
-
-test-bandit: ../.venv bandit.ini
-# Currently only care about high severity reported issues. Once this is reached,
-# go and enable the medium/low checks.
- $(BANDIT) -c ../bandit.yaml -r -lll --ini bandit.ini $(BANDIT_OUTPUT_ARGS)
+test-pylint: $(VENV)
+ $(PYTEST) -T pylint
test-shellcheck:
@CMK_DIR="$(realpath ..)" ; \
@@ -80,3 +77,9 @@ test-shellcheck:
$(SHELLCHECK_OUTPUT_ARGS) \
$$(grep -l '^#!/.*sh' $$CMK_DIR/agents/* $$CMK_DIR/agents/plugins/*
$$CMK_DIR/agents/special/* 2>/dev/null) \
"$$ENTERPRISE_DIR/agents/mk-remote-alert-handler"
+
+test-unit: $(VENV)
+ $(PYTEST) -T unit
+
+test-unit-coverage-html: $(VENV)
+ $(COVERAGE) run --rcfile=.coveragerc_unit -m pytest -T unit ; $(COVERAGE) html