@@ -43,7 +43,7 @@ PHONY += uninstall
4343uninstall: pyenvuninstall
4444
4545PHONY += clean
46−clean: pyclean node.clean
46+clean: pyclean node.clean test.clean
4747 $(call cmd,common_clean)
4848
4949PHONY += run
@@ -160,27 +160,52 @@ PHONY += docker
160160docker:
161161 $(Q)./manage.sh docker_build
162162
163+# gecko
164+# -----
165+
166+PHONY += gecko.driver
167+gecko.driver:
168+ $(PY_ENV_ACT); ./manage.sh install_geckodriver
163169
164170# test
165171# ----
166172
167−PHONY += test test.pylint test.pep8 test.unit test.robot
173+PHONY += test test.pylint test.pep8 test.unit test.coverage test.robot
168174
169−test: test.pylint test.pep8 test.unit test.robot
175+test: test.pylint test.pep8 test.unit gecko.driver test.robot
170176
171177# TODO: balance linting with pylint
172178test.pylint: pyenvinstall
173− $(call cmd,pylint,searx/preferences.py)
174− $(call cmd,pylint,searx/testing.py)
179+ $(call cmd,pylint,\
180+ searx/preferences.py \
181+ searx/testing.py \
182+ )
183+
184+# ignored rules:
185+# E402 module level import not at top of file
186+# W503 line break before binary operator
175187
176188test.pep8: pyenvinstall
177− $(PY_ENV_ACT); ./manage.sh pep8_check
189+ @echo "TEST pep8"
190+ $(Q)$(PY_ENV_ACT); pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" searx tests
178191
179192test.unit: pyenvinstall
180− $(PY_ENV_ACT); ./manage.sh unit_tests
181−
182−test.robot: pyenvinstall
183− $(PY_ENV_ACT); ./manage.sh install_geckodriver
184− $(PY_ENV_ACT); ./manage.sh robot_tests
193+ @echo "TEST tests/unit"
194+ $(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
195+
196+test.coverage: pyenvinstall
197+ @echo "TEST unit test coverage"
198+ $(Q)$(PY_ENV_ACT); \
199+ python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
200+ && coverage report \
201+ && coverage html \
202+
203+test.robot: pyenvinstall gecko.driver
204+ @echo "TEST robot"
205+ $(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
206+
207+test.clean:
208+ @echo "CLEAN intermediate test stuff"
209+ $(Q)rm -rf geckodriver.log .coverage coverage/
185210
186211.PHONY: $(PHONY)