pytest-django advertises “easy switching.” While it’s true that existing unittest-style tests will work without any modifications, you may have problems switching if you depend on the order in which the Django test runner runs tests. This plugin helps preserve that order if you need it to run your tests.
Motivation
The Django test runner gives priority to Django TestCase subclasses, executing them before other Django-based tests (e.g., TransactionTestCase) and any other unittest.TestCase tests. Put differently, Django runs tests which reset the database by rolling back a transaction before tests which reset the database by truncating all tables.
pytest-django doesn’t preserve this ordering out of the box. For more, see #214. This isn’t a problem if your project’s tests can run independently of each other, in any order. However, if your project’s tests rely on initial data populated via fixtures or migrations, tests which reset the database by rolling back a transaction must run before tests which reset the database by truncating all tables, thereby deleting any initial data. The serialized_rollback option can be used to deal with this issue within a TransactionTestCase, but it has no effect across distinct test cases; once you exit a TransactionTestCase, any initial data is gone.
Installation
This plugin supports Python 2.7, 3.5, and 3.6. Install with pip:
$ pip install pytest-django-ordering
You’re done! pytest will automatically find and integrate the plugin.
Metadata
Release files for pytest-django-ordering 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest-django-ordering-1.2.0.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_django_ordering-1.2.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 7.4 kB
Release files / pytest-django-ordering-1.2.0.tar.gz
| Download URL | pytest-django-ordering-1.2.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21764c5c50c533b08a5584c7713c53a9380c7c996026584c410ad514cf287581
|
|
BLAKE2b-256 checksum How to use checksums |
fbc56367c78118aff7f2a396c059da92eeaa1b357ad4b5256ca40ad4f423970d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15
|
Release files / pytest_django_ordering-1.2.0-py2.py3-none-any.whl
| Download URL | pytest_django_ordering-1.2.0-py2.py3-none-any.whl |
|---|---|
| Size | 4.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1bfaed312d8f4f1cda38840e459287ec7619e9b14d052b060775444641062aad
|
|
BLAKE2b-256 checksum How to use checksums |
b64fc1cb44c5265f14269715a07f135d4cca7cf07724ed7ca5e76d5d60188dba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.15
|