pytest framework for testing different aspects of a common method
Project description
pytest-common-subject
pytest-common-subject is a "framework" for organizing tests to reduce boilerplate while writing, improve skimmability when reading, and bolster parallelization when executing the suite.
To utilize this framework, we first choose a single function that our group of tests will all call — in other words, an entry point, or a common subject. This function will be automatically called before each of our tests, with args and kwargs that can be customized by overriding fixtures — enabling child test classes to make HTTP requests as a different user, or to use a different cache backend, or to change the value of a monkeypatched method.
The return value of the chosen function will be passed as a fixture to each test. To reap the full benefits of the framework, create separate tests to verify different aspects of the return value. Was the response status code a 200? Did the response contain the expected data? Were the expected rows created in the database? By using separate tests for each of these aspects, we can pinpoint and correct multiple bugs at once, instead of getting sucked into a fix-test-fix cycle with its chorus of "oh, bother, not again!"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytest-common-subject-1.0.1.tar.gz
.
File metadata
- Download URL: pytest-common-subject-1.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.12 CPython/3.6.7 Linux/4.18.0-20-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e94ab317cb3180f9cd1b18b533a1b88dc3be9e186f53e1de83f0389300310ae |
|
MD5 | 4e29c5e15c37f0073c077d1a3f88cba0 |
|
BLAKE2b-256 | 490f7d2eb57950c661bd630cd1b87a4c79a866b111933a2fe692331da2e95e68 |
File details
Details for the file pytest_common_subject-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: pytest_common_subject-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.12 CPython/3.6.7 Linux/4.18.0-20-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c305627e822e93572df80cb5605255358eddece0a9d4d21b8aeebc8c0311370 |
|
MD5 | f2f4579646e9dea6b0ccedeeb9b8cab9 |
|
BLAKE2b-256 | 6a5c3f328b2b9e77e48b480612c670d3cafa633cd70a93213a4bdaf06159c9a6 |