graphql-engine/scripts/make/legacy-tests.mk
Samir Talwar b690a3fc3a server/tests-py: Install the pytest-durations plugin.
[pytest-durations][] is an enhancement to pytest over the built-in
[`--durations` parameter][] which also shows the duration of setup,
teardown, and fixtures that take the longest.

While it's not strictly necessary now, I used it to figure out what was
taking so long when trying to run things in parallel, and found it very
helpful, so I think it's worth preserving.

[pytest-durations]: https://pypi.org/project/pytest-durations/
[`--durations` parameter]: https://docs.pytest.org/en/6.2.x/usage.html#profiling-test-execution-duration

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5480
GitOrigin-RevId: b789418dd4c971adb91e08b7837a962bede44452
2022-08-15 16:15:37 +00:00

32 lines
1.2 KiB
Makefile

LEGACY_TESTS = server/tests-py
LEGACY_TESTS_VENV = $(LEGACY_TESTS)/.hasura-dev-python-venv
# cryptography v3.4.8 requires Rust dependencies by default, but we don't need them for our tests.
# The following environment variable disables this requirement.
# https://cryptography.io/en/3.4.8/faq.html#installing-cryptography-fails-with-error-can-not-find-rust-compiler
export CRYPTOGRAPHY_DONT_BUILD_RUST = 1
# Make's automatic variables such as `$<` and `$@` can be confusing.
# If you are unsure what they do, please consult the documentation.
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
$(LEGACY_TESTS_VENV): $(LEGACY_TESTS)/requirements.txt
rm -rf "$(LEGACY_TESTS_VENV)"
python3 -m venv "$(LEGACY_TESTS_VENV)"
source "$@/bin/activate"; \
pip3 install -r $<
touch $@
$(LEGACY_TESTS)/requirements.txt: $(LEGACY_TESTS)/requirements-top-level.txt
rm -rf "$(LEGACY_TESTS_VENV)"
python3 -m venv "$(LEGACY_TESTS_VENV)"
source "$(LEGACY_TESTS_VENV)/bin/activate"; \
pip3 install wheel; \
pip3 install -r $<; \
( \
echo '# Do not modify this file directly. Instead, modify $<.'; \
echo '# Then, run `make server/tests-py/requirements.txt` to regenerate this file.'; \
echo; \
pip3 freeze \
) > $@