diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 8d42183..0685e88 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -34,4 +34,4 @@ jobs: - name: Check types run: make types - name: Run tests - run: pytest -o console_output_style=classic -v + run: pytest -o console_output_style=classic -v || ([ $? = 5 ] && exit 0 || exit $?) diff --git a/Makefile b/Makefile index a822f7c..49c15e3 100644 --- a/Makefile +++ b/Makefile @@ -26,3 +26,7 @@ format: .PHONY: types types: mypy . + +.PHONY: test +test: + sh -c 'pytest tests || ([ $$? = 5 ] && exit 0 || exit $$?)' diff --git a/test b/test index 84ef6d3..b5751f6 100755 --- a/test +++ b/test @@ -3,4 +3,4 @@ set -e make check -pytest "$@" +make test diff --git a/tests/conftest.py b/tests/conftest.py index e69de29..94f963c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -0,0 +1,7 @@ +NO_TESTS_COLLECTED = 5 +SUCCESS = 0 + + +def pytest_sessionfinish(session, exitstatus): + if exitstatus == NO_TESTS_COLLECTED and session.config.getoption("-k"): + session.exitstatus = SUCCESS