Commit c9b33f46 authored by Vít Starý Novotný's avatar Vít Starý Novotný
Browse files

made the pylint2 and pylint3 tests faster

parent 1c4ae1d9
Loading
Loading
Loading
Loading
+18 −23
Original line number Diff line number Diff line
@@ -2,28 +2,31 @@

IGNORED_PYLINT_TESTS=invalid-name missing-docstring \
	redefined-variable-type too-few-public-methods
IGNORED_PYLINT2_TESTS=superfluous-parens
IGNORED_PYLINT3_TESTS=
IGNORED_PYLINT2_TESTS=superfluous-parens duplicate-code
IGNORED_PYLINT3_TESTS=duplicate-code

tests:
	# all tests
	@make -j 3 output pylint2 pylint3
	# all ok
	# all tests ok

output:
	# testing python script output
	# python output test
	@set -e; \
	TEMP=`mktemp`; \
	trap 'rm $$TEMP' EXIT; \
	for FILE in *.py; do \
		printf 'output test:\t%s\n' "$$FILE"; \
		printf '# python output test "%s"\n' "$$FILE"; \
		if [ -e "$$FILE.out" ]; then \
			python "$$FILE" > $$TEMP; \
			diff "$$FILE.out" $$TEMP; \
			printf '# python output test "%s" ok\n' "$$FILE"; \
		else \
			printf 'No output test exists for file "%s".\n' "$$FILE"; \
			exit 1; \
		fi; \
	done
	# python output test ok

COMMA:=,
EMPTY:=
@@ -34,23 +37,15 @@ PYLINT3_OPTIONS=--disable=$(subst $(SPACE),$(COMMA),\
	$(IGNORED_PYLINT_TESTS) $(IGNORED_PYLINT3_TESTS))

pylint2:
	# testing python scripts via pylint2
	@for FILE in *.py; do \
		printf 'pylint2 test:\t%s\n' "$$FILE"; \
		REPORT="$$(pylint $(PYLINT2_OPTIONS) "$$FILE" 2>&1)"; \
		if ! [ $$? = 0 ]; then \
			printf '%s\nThe above report is for file "%s".\n' "$$REPORT" "$$FILE"; \
			exit 1; \
		fi; \
	done
	# pylint2 test
	@if ! REPORT="$$(pylint $(PYLINT2_OPTIONS) *.py 2>&1)"; then \
		printf "%s\n" "$$REPORT"; \
	fi
	# pylint2 test ok

pylint3:
	# testing python scripts via pylint3
	@for FILE in *.py; do \
		printf 'pylint3 test:\t%s\n' "$$FILE"; \
		REPORT="$$(pylint3 $(PYLINT3_OPTIONS) "$$FILE" 2>&1)"; \
		if ! [ $$? = 0 ]; then \
			printf '%s\nThe above report is for file "%s".\n' "$$REPORT" "$$FILE"; \
			exit 1; \
		fi; \
	done
	# pylint3 test
	@if ! REPORT="$$(pylint3 $(PYLINT3_OPTIONS) *.py 2>&1)"; then \
		printf "%s\n" "$$REPORT"; \
	fi
	# pylint3 test ok