Skip to content

Commit

Permalink
Use pytest-custom_exit_code to pass when no tests are found
Browse files Browse the repository at this point in the history
This is important for the directories where we don't yet have tests.
This is only relevant for when the Makefile runs pytest, because pants
only runs pytest on files that exist, but the Makefile
blindly tries to run on every component directory.
  • Loading branch information
cognifloyd committed Dec 18, 2024
1 parent 06a0189 commit 956e1e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ endif
# The minus in front of st2.st2common.bootstrap filters out logging statements from that module.
# https://github.com/pytest-dev/pytest-xdist/issues/71
#PYTEST_OPTS := -n auto --tx 2*popen//execmodel=eventlet
PYTEST_OPTS := -s --log-level=error
# --suppress-no-test-exit-code is part of the pytest-custom_exit_code plugin
PYTEST_OPTS := -s --log-level=error --suppress-no-test-exit-code

ifndef PIP_OPTIONS
PIP_OPTIONS :=
Expand Down Expand Up @@ -1099,7 +1100,7 @@ runners-itests: requirements .runners-itests
echo "==========================================================="; \
echo "Running integration tests in" $$component; \
echo "==========================================================="; \
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS)
. $(VIRTUALENV_DIR)/bin/activate; pytest --capture=no --verbose $(PYTEST_OPTS) \
--cov=$$component --cov-report=html $$component/tests/integration || ((failed+=1)); \
done; \
echo failed=$$failed; \
Expand Down
2 changes: 2 additions & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ pytest-benchmark[histogram]==3.4.1
pytest-icdiff==0.9
pytest-cov==3.0.0
pytest-xdist==2.5.0
# for Makefile-based pytest runs
pytest-custom_exit_code
# zstandard is used for micro benchmarks
zstandard==0.23.0
# ujson is used for micro benchmarks
Expand Down

0 comments on commit 956e1e8

Please sign in to comment.