Pytest, but made easy
The easiest way to test your projects with pytest.
Why?
I had some tests that, when running all together, were failing due to memory issues. This is the way I solved it, and also I can log the results of my tests and clean the tests files folders very easy each time the tests are executed.
Functionality
Simplify the way we do our tests in python and run tests individually to be more accurate (and a bit slower, but is testing, accuracy is more important).
There are 2 tags:
mandatoryfor the tests that must be tested and passed always in order to go on, make a commit or upload a new version.additionalfor the tests that are validating some optional or experimental functionality that is not needed for a commit or a new version.
You should tests always the mandatory to know that your app base code is still working, even though some experimental features could fail.
Usage
The tests folder will be your new friend. Keep a test_general.py to always do a simple test. Have the conftest.py to configure what has to be done before and after the tests are running.
Some code to apply in your tests:
- Test that an exception is raised with a specific message.
from pytest_easy import assert_exception_is_raised
assert_exception_is_raised(lambda: 1 / 0, exception_type = None, message = 'division by zero')
- Compare float values
from pytest_easy import float_approx_to_compare
assert 3.99 == float_approx_to_compare(3.99)
- Check that a dependency is not installed
from pytest_easy import is_dependency_installed
assert not is_dependency_installed('opencv-python')
Check test_various.py to see more examples.
This will execute the tests and remove all the new files in the test_files folder that were not before the tests were executed, or you can simply comment the test_files_handler.delete_new_files() line before running them, so the generated files are not removed in that execution, uncomment it, and they won't be removed in the next execution because they were already there.
There are some .bat files included to run the tests in 3 different modes:
run_tests.bat- Non-isolated mode, normal mode.run_tests_isolated.bat- Isolated mode, our way.run_mandatory_tests.bat- Run only the tests with the@mandatorypytest mark.
Metadata
Release files for pytest-easy 0.0.5
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_easy-0.0.5.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_easy-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / pytest_easy-0.0.5.tar.gz
| Download URL | pytest_easy-0.0.5.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
333c96cd818b62acf5c34b7956436d7378a00897c0f4f687cbb139ded19edb35
|
|
BLAKE2b-256 checksum How to use checksums |
6b49d758b3bf478c7d69a680d58c9a47a5799deac16f22767bbada98de24c526
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.0 CPython/3.9.0 Windows/10
|
Release files / pytest_easy-0.0.5-py3-none-any.whl
| Download URL | pytest_easy-0.0.5-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
afbabd82295cff2b4ced7b0fade8cbda03f57b53b511ddceae9df75bf81640dc
|
|
BLAKE2b-256 checksum How to use checksums |
3e1316e7836976d4e8d0031a4f2156113e281856c7b84bb856586ecdf4ed8d58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.0 CPython/3.9.0 Windows/10
|