@@ -9,7 +9,7 @@ PYTHON_MAJOR ?= 3
99PYTHON_MINOR ?= 4
1010
1111# Test settings
12- UNIT_TEST_COVERAGE := 77
12+ UNIT_TEST_COVERAGE := 72
1313INTEGRATION_TEST_COVERAGE := 52
1414COMBINED_TEST_COVERAGE := 94
1515
@@ -82,6 +82,11 @@ $(ALL_FLAG): $(SOURCES)
8282.PHONY : ci
8383ci : check test tests
8484
85+ .PHONY : watch
86+ watch : depends-dev .clean-test
87+ @ rm -rf $(FAILED_FLAG )
88+ $(SNIFFER )
89+
8590# Development Installation #####################################################
8691
8792.PHONY : env
@@ -163,39 +168,44 @@ check: pep8 pep257 pylint
163168
164169.PHONY : pep8
165170pep8 : depends-ci
166- $(PEP8 ) $(PACKAGE ) --config=.pep8rc
171+ $(PEP8 ) $(PACKAGE ) tests --config=.pep8rc
167172
168173.PHONY : pep257
169174pep257 : depends-ci
170- # D102: docstring missing (checked by PyLint)
171- # D202: No blank lines allowed *after* function docstring
172- $(PEP257) $(PACKAGE) --ignore=D102,D202
175+ # D102/D103: docstring missing (checked by PyLint)
176+ # D202: No blank lines allowed *after* function docstring (personal preference)
177+ # D203: 1 blank line required before class (deprecated warning)
178+ $(PEP257) $(PACKAGE) tests --ignore=D102,D103,D202,D203
173179
174180.PHONY : pylint
175181pylint : depends-ci
176- $(PYLINT ) $(PACKAGE ) --rcfile=.pylintrc --disable=C0111
182+ # These warnings shouldn't fail builds, but warn in editors:
183+ # C0111: Line too long
184+ # R0913: Too many arguments
185+ # R0914: Too many local variables
186+ $(PYLINT) $(PACKAGE) tests --rcfile=.pylintrc --disable=missing-docstring,too-many-statements
177187
178188.PHONY : fix
179189fix : depends-dev
180190 $(PEP8RADIUS ) --docformatter --in-place
181191
182192# Testing ######################################################################
183193
184- TIMESTAMP : = $(shell date +% s)
194+ RANDOM_SEED ? = $(shell date +% s)
185195
186196PYTEST_CORE_OPTS := --doctest-modules --verbose -r X --maxfail=3
187197PYTEST_COV_OPTS := --cov=$(PACKAGE ) --cov-report=term-missing --no-cov-on-fail
188- PYTEST_RANDOM_OPTS := --random --random-seed=$(TIMESTAMP )
198+ PYTEST_RANDOM_OPTS := --random --random-seed=$(RANDOM_SEED )
189199
190200PYTEST_OPTS := $(PYTEST_CORE_OPTS ) $(PYTEST_COV_OPTS ) $(PYTEST_RANDOM_OPTS )
191201PYTEST_OPTS_FAILFAST := $(PYTEST_OPTS ) --failed --exitfirst
192202
193- FAILED := .pytest/failed
203+ FAILED_FLAG := .pytest/failed
194204
195205.PHONY : test test-unit
196206test : test-unit
197207test-unit : depends-ci
198- @ if test -e $( FAILED ) ; then $( MAKE) test-all; fi
208+ @ if test -e $( FAILED_FLAG ) ; then $( MAKE) test-all; fi
199209 @ $(COVERAGE ) erase
200210 $(PYTEST ) $(PYTEST_OPTS ) $(PACKAGE )
201211ifndef TRAVIS
@@ -204,39 +214,34 @@ endif
204214
205215.PHONY : test-int
206216test-int : depends-ci
207- @ if test -e $( FAILED ) ; then $( MAKE) test-all; fi
217+ @ if test -e $( FAILED_FLAG ) ; then $( MAKE) test-all; fi
208218 @ $(COVERAGE ) erase
209219 TEST_INTEGRATION=1 $(PYTEST ) $(PYTEST_OPTS_FAILFAST ) tests
210220ifndef TRAVIS
211- @ rm -rf $(FAILED ) # next time, don't run the previously failing test
221+ @ rm -rf $(FAILED_FLAG ) # next time, don't run the previously failing test
212222 $(COVERAGE) html --directory htmlcov --fail-under=$(INTEGRATION_TEST_COVERAGE)
213223endif
214224
215225.PHONY : tests test-all
216226tests : test-all
217227test-all : depends-ci
218- @ if test -e $( FAILED ) ; then $( PYTEST) --failed $( PACKAGE) tests; fi
228+ @ if test -e $( FAILED_FLAG ) ; then $( PYTEST) --failed $( PACKAGE) tests; fi
219229 @ $(COVERAGE ) erase
220230 TEST_INTEGRATION=1 $(PYTEST ) $(PYTEST_OPTS_FAILFAST ) $(PACKAGE ) tests
221231ifndef TRAVIS
222- @ rm -rf $(FAILED ) # next time, don't run the previously failing test
232+ @ rm -rf $(FAILED_FLAG ) # next time, don't run the previously failing test
223233 $(COVERAGE) html --directory htmlcov --fail-under=$(COMBINED_TEST_COVERAGE)
224234endif
225235
226236.PHONY : read-coverage
227237read-coverage :
228238 $(OPEN ) htmlcov/index.html
229239
230- .PHONY : watch
231- watch : depends-dev .clean-test
232- @ rm -rf $(FAILED )
233- $(SNIFFER )
234-
235240# Cleanup ######################################################################
236241
237242.PHONY : clean
238243clean : .clean-dist .clean-test .clean-doc .clean-build
239- rm -rf $(ALL )
244+ rm -rf $(ALL_FLAG )
240245
241246.PHONY : clean-env
242247clean-env : clean
@@ -274,7 +279,7 @@ register-test: doc
274279 $(PYTHON ) setup.py register --strict --repository https://testpypi.python.org/pypi
275280
276281.PHONY : upload-test
277- upload-test : .git-no-changes register-test
282+ upload-test : register-test
278283 $(PYTHON ) setup.py sdist upload --repository https://testpypi.python.org/pypi
279284 $(PYTHON ) setup.py bdist_wheel upload --repository https://testpypi.python.org/pypi
280285 $(OPEN ) https://testpypi.python.org/pypi/$(PROJECT )
@@ -291,7 +296,7 @@ upload: .git-no-changes register
291296
292297.PHONY : .git-no-changes
293298.git-no-changes :
294- @if git diff --name-only --exit-code; \
299+ @ if git diff --name-only --exit-code; \
295300 then \
296301 echo Git working copy is clean...; \
297302 else \
0 commit comments