-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Describe the bug
When we add --no-monitor to the pytest.ini like so addopts = --no-monitor, pytest.raises, django_assert_num_queries and django_assert_max_num_queries (the latter two are provided by pytest-django) do not work anymore. They should be raising test failures.
To Reproduce
Steps to reproduce the behavior:
0. (install django, pytest, pytetst-monitor and pytest-django)
- create a django project
- create an app
- create Book model in app
- run tests below with
--no-monitor=> all tests pass - run tests below without
--no-monitor=> all tests fail
import pytest
from books.models import Book
def test_raise_exception():
with pytest.raises(Exception):
x = 1 / 1
def test_query_assertion(django_assert_num_queries, db):
with django_assert_num_queries(0):
print(Book.objects.all())
def test_max_queries_assertion(django_assert_max_num_queries, db):
with django_assert_max_num_queries(0):
print(Book.objects.all())
Expected behavior
The tests should fail, even though the --no-monitor flag was provided.
Desktop (please complete the following information):
- OS: Ubuntu 22.04
- Python version: 3.11
- Pytest version: 8.2.0
- pytest-monitor version: 1.6.6
Additional context
Please ask if I missed to provide necessary information!
Metadata
Metadata
Assignees
Labels
No labels