Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEBUG: pytest-10865 #9231

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/python-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ jobs:
- database: "postgres:14"
pytest-options: "--only-services"


fail-fast: false

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -194,12 +193,12 @@ jobs:
# Parallelize tests by scope to reduce expensive service fixture duplication
# Do not allow the test suite to build images, as we want the prebuilt images to be tested
# Do not run Kubernetes service tests, we do not have a cluster available
pytest tests -vvv --numprocesses auto --dist loadscope --disable-docker-image-builds --exclude-service kubernetes --durations=25 --cov=src/ --cov=tests/ --no-cov-on-fail --cov-report=term --cov-config=setup.cfg ${{ matrix.pytest-options }}
pytest -vvv tests/test_example.py

- name: Check database container
# Only applicable for Postgres, but we want this to run even when tests fail
if: always()
run: >
docker container inspect postgres
&& docker container logs postgres
|| echo "Ignoring bad exit code"
|| echo "Ignoring bad exit code"
15 changes: 15 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest
import warnings


def test_example_one():
with pytest.warns(UserWarning):
warnings.warn(1)

# This test passes but should raise a `TypeError` as demonstrated in `example_two`


def test_example_two():
with pytest.raises(TypeError):
warnings.warn(1)