pytest-django
pytest-django copied to clipboard
A Django plugin for pytest.
This is basically a repost of my question from stackoverflow. I hope it will be more useful here. I have a Django application, and I'm trying to test it using...
Pytest django should redirect `settings.MEDIA_ROOT` automatically so that the state isn't shared between tests in the form of media. For compatibility with pytest-xdist, maybe each test run can have it's...
For a given scenario, I need to undo some migrations in order to let the test database be gracefully deleted. One of those migrations creates a replication subscription that avoids...
Fixes wrong type hints mentioned in https://github.com/pytest-dev/pytest-django/issues/1137
Fix type hints for Django assert helpers `assertFormError` and `assertFormSetError`.
I try to use this, but in fact settings var that was initialized in docker container doesn't change. conftest.py ``` @pytest.hookimpl(tryfirst=True) def pytest_load_initial_conftests(early_config, parser, args): os.environ["CH_BASE_OF_URL"] = 'https://api.cowho.com' ``` settings.py...
This PR adds short docstrings to quickly check available fixtures and is especially usefull for new pytest-django users. I've noticed that some public fixtures don't have docstrings to give the...
I use `--no-migrations` option to create a test database by inspecting all models. This usually works well, but I got a problem with django models that have an `app_label` meta...
With `OneToOneField`, Django raises `Model.DoesNotExist` which is converted by its template engine to `string_if_invalid`: https://github.com/django/django/blob/5.0.7/django/template/base.py#L932-L933 It is usually falsy, hence the need for `InvalidVarException.__bool__` to return `bool(self.origin_value)` to be consistent...
inspect.stack() returns a list of namedtuple (or retrocompatible objects) since Python 3.5+: let's use the named attribute. cf https://docs.python.org/3/library/inspect.html#inspect.stack And once we have access to a FrameInfo object/namedtuple, access to...