forked from zaclys/searxng
test: move tests from manage.sh to Makefile
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
e7fbefa8bd
commit
1075f58a72
45
Makefile
45
Makefile
|
@ -43,7 +43,7 @@ PHONY += uninstall
|
||||||
uninstall: pyenvuninstall
|
uninstall: pyenvuninstall
|
||||||
|
|
||||||
PHONY += clean
|
PHONY += clean
|
||||||
clean: pyclean node.clean
|
clean: pyclean node.clean test.clean
|
||||||
$(call cmd,common_clean)
|
$(call cmd,common_clean)
|
||||||
|
|
||||||
PHONY += run
|
PHONY += run
|
||||||
|
@ -160,27 +160,52 @@ PHONY += docker
|
||||||
docker:
|
docker:
|
||||||
$(Q)./manage.sh docker_build
|
$(Q)./manage.sh docker_build
|
||||||
|
|
||||||
|
# gecko
|
||||||
|
# -----
|
||||||
|
|
||||||
|
PHONY += gecko.driver
|
||||||
|
gecko.driver:
|
||||||
|
$(PY_ENV_ACT); ./manage.sh install_geckodriver
|
||||||
|
|
||||||
# test
|
# test
|
||||||
# ----
|
# ----
|
||||||
|
|
||||||
PHONY += test test.pylint test.pep8 test.unit test.robot
|
PHONY += test test.pylint test.pep8 test.unit test.coverage test.robot
|
||||||
|
|
||||||
test: test.pylint test.pep8 test.unit test.robot
|
test: test.pylint test.pep8 test.unit gecko.driver test.robot
|
||||||
|
|
||||||
# TODO: balance linting with pylint
|
# TODO: balance linting with pylint
|
||||||
test.pylint: pyenvinstall
|
test.pylint: pyenvinstall
|
||||||
$(call cmd,pylint,searx/preferences.py)
|
$(call cmd,pylint,\
|
||||||
$(call cmd,pylint,searx/testing.py)
|
searx/preferences.py \
|
||||||
|
searx/testing.py \
|
||||||
|
)
|
||||||
|
|
||||||
|
# ignored rules:
|
||||||
|
# E402 module level import not at top of file
|
||||||
|
# W503 line break before binary operator
|
||||||
|
|
||||||
test.pep8: pyenvinstall
|
test.pep8: pyenvinstall
|
||||||
$(PY_ENV_ACT); ./manage.sh pep8_check
|
@echo "TEST pep8"
|
||||||
|
$(Q)$(PY_ENV_ACT); pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" searx tests
|
||||||
|
|
||||||
test.unit: pyenvinstall
|
test.unit: pyenvinstall
|
||||||
$(PY_ENV_ACT); ./manage.sh unit_tests
|
@echo "TEST tests/unit"
|
||||||
|
$(Q)$(PY_ENV_ACT); python -m nose2 -s tests/unit
|
||||||
|
|
||||||
test.robot: pyenvinstall
|
test.coverage: pyenvinstall
|
||||||
$(PY_ENV_ACT); ./manage.sh install_geckodriver
|
@echo "TEST unit test coverage"
|
||||||
$(PY_ENV_ACT); ./manage.sh robot_tests
|
$(Q)$(PY_ENV_ACT); \
|
||||||
|
python -m nose2 -C --log-capture --with-coverage --coverage searx -s tests/unit \
|
||||||
|
&& coverage report \
|
||||||
|
&& coverage html \
|
||||||
|
|
||||||
|
test.robot: pyenvinstall gecko.driver
|
||||||
|
@echo "TEST robot"
|
||||||
|
$(Q)$(PY_ENV_ACT); PYTHONPATH=. python searx/testing.py robot
|
||||||
|
|
||||||
|
test.clean:
|
||||||
|
@echo "CLEAN intermediate test stuff"
|
||||||
|
$(Q)rm -rf geckodriver.log .coverage coverage/
|
||||||
|
|
||||||
.PHONY: $(PHONY)
|
.PHONY: $(PHONY)
|
||||||
|
|
42
manage.sh
42
manage.sh
|
@ -70,40 +70,6 @@ locales() {
|
||||||
pybabel compile -d "$SEARX_DIR/translations"
|
pybabel compile -d "$SEARX_DIR/translations"
|
||||||
}
|
}
|
||||||
|
|
||||||
pep8_check() {
|
|
||||||
echo '[!] Running pep8 check'
|
|
||||||
# ignored rules:
|
|
||||||
# E402 module level import not at top of file
|
|
||||||
# W503 line break before binary operator
|
|
||||||
pep8 --exclude=searx/static --max-line-length=120 --ignore "E402,W503" "$SEARX_DIR" "$BASE_DIR/tests"
|
|
||||||
}
|
|
||||||
|
|
||||||
unit_tests() {
|
|
||||||
echo '[!] Running unit tests'
|
|
||||||
python -m nose2 -s "$BASE_DIR/tests/unit"
|
|
||||||
}
|
|
||||||
|
|
||||||
py_test_coverage() {
|
|
||||||
echo '[!] Running python test coverage'
|
|
||||||
PYTHONPATH="`pwd`" python -m nose2 -C --log-capture --with-coverage --coverage "$SEARX_DIR" -s "$BASE_DIR/tests/unit" \
|
|
||||||
&& coverage report \
|
|
||||||
&& coverage html
|
|
||||||
}
|
|
||||||
|
|
||||||
robot_tests() {
|
|
||||||
echo '[!] Running robot tests'
|
|
||||||
PYTHONPATH="`pwd`" python "$SEARX_DIR/testing.py" robot
|
|
||||||
}
|
|
||||||
|
|
||||||
tests() {
|
|
||||||
set -e
|
|
||||||
pep8_check
|
|
||||||
unit_tests
|
|
||||||
install_geckodriver
|
|
||||||
robot_tests
|
|
||||||
set +e
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Web
|
# Web
|
||||||
|
@ -220,14 +186,6 @@ Commands
|
||||||
Build
|
Build
|
||||||
-----
|
-----
|
||||||
locales - Compile locales
|
locales - Compile locales
|
||||||
|
|
||||||
Tests
|
|
||||||
-----
|
|
||||||
unit_tests - Run unit tests
|
|
||||||
pep8_check - Pep8 validation
|
|
||||||
robot_tests - Run selenium tests
|
|
||||||
tests - Run all python tests (pep8, unit, robot_tests)
|
|
||||||
py_test_coverage - Unit test coverage
|
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue