test: refactor webui test flow
Summary
- chore: align usage of
config.getoption
in pytest - chore: more error injection logs
- test: refactor webui test flow
Having two different fixtures binary_path
and
path_to_binary_with_webui
results in weird failures in CI:
FAILED test/int/test_couple.py::test_exit_after_apply - conftest.TarantoolError:
('ER_NO_SUCH_PROC', "Procedure 'pico._inject_error' is not defined")
The root cause is that one cargo build
overrides another with
different features enabled. To resolve the issue this patch
significantly refactors the test flow:
-
Web UI tests are skipped by default. One can enable it explicitly with
pytest --with-webui
-
New fixture
cargo_build
behavior depends on environment:- In local dev environment it rebuilds the project with required features
- In CI it skips rebuilding and runs tests against the existing build
-
The
path_to_binary_with_webui
fixture is removed.
See also:
- https://stackoverflow.com/a/55769818/1182787
- https://docs.pytest.org/en/7.4.x/how-to/writing_hook_functions.html
- https://docs.pytest.org/en/7.4.x/how-to/mark.html
- https://docs.pytest.org/en/7.4.x/example/simple.html#control-skipping-of-tests-according-to-command-line-option
Close #435 (closed)
How it looks like
$ pytest -k http_server
test/int/test_http_server.py::test_http_routes PASSED
test/int/test_http_server.py::test_webui SKIPPED (run: pytest --with-webui)
$ pytest -k http_server --with-webui
test/int/test_http_server.py::test_http_routes PASSED
test/int/test_http_server.py::test_webui PASSED
$ cargo b
$ CI=true pytest -k http_server --with-webui
test/int/test_http_server.py::test_http_routes PASSED
test/int/test_http_server.py::test_webui FAILED
Ensure that
-
New code is covered by tests -
API is documented -
Changelog is up to date -
(if Lua API changed) Lua API version is bumped inluamod.rs
-
(if necessary) A follow-up doc issue is created in picodata/docs and linked here
Edited by Yaroslav Dynnikov