Write dependent integration tests. See my pycon talk.
Project description
Entest
God is testing you
Most of the testing frameworks are pretty old and all of them (python or otherwise) treat unit tests as first class citizens. The ideas of this lib are based on the Testing Trophy. This means that we consider integration tests to be more important. This lib provides a convenient way to explicitly define dependency relationships between tests. Improves transparency of globally needed assets (think fixtures but better).
For how that would look like practically see tests/example.py. This code is referred to in my PyCon talk.
https://www.ganjing.com/video/1fic7807r1p1YVbLCkn4uytkJ1c11c
Demo
Installing
pip install entest[all]
Documentation
See tests/example.py.
To have a test implicitly depend on all other tests use run_last flag. This is the case for teardown of critical resources for example users. To skip these tests use --skip-teardown or set ENTEST_SKIP_TEARDOWN environment variable.
To have all tests implicitly depend on a given test place it closer to the root of the graph.
Use setup_setup to take advantage of depends_on default behavior. (i.e. for the first decorated function in a module TEST_ROOT is taken do be the previous test)
To have a test depend on another test NOT being run use without flag. This is usefull for testing error flows.
Contributing
Please do not maintain a fork! Make a pull request and if it is not obviously bad I will merge it in a timely manner.
python3 -m venv .venv
. .venv/bin/activate
pip install poetry
poetry install
echo "
export PYTHONPATH=$PWD
alias entest="python3 ./entest/cli.py"
" >> .venv/bin/activate
export PYTHONPATH=$PWD
alias entest="python3 ./entest/cli.py"
I would like to change a lot of things structure-wise, but API will stay the same. In particular:
depends_ondecorator with kwargsprevious,run_lastandwithout.STATUSclassificator. I see how it can be misused easily, but I will still ship this footgun.
Run tests
entest --graph
entest
entest --skip-teardown
entest --env env_name tests/example.py --snoop
Roadmap
- Better error output with
stackprinter. - Verbose mode that automatically applies
pySnooperorcyberbrain. - An
initcommand that sets up the tests folder with env subfolder.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file entest-0.1.16.tar.gz.
File metadata
- Download URL: entest-0.1.16.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.7 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
442df925a2278a6976f604c397637e60047f6816b3103584e1264e00ec221d2e
|
|
| MD5 |
55824aa7f7290bf79de29a34acea7721
|
|
| BLAKE2b-256 |
05a4ad61a2441048754f925110db9025c73eac7f07d0087af47bbe242453014e
|
File details
Details for the file entest-0.1.16-py3-none-any.whl.
File metadata
- Download URL: entest-0.1.16-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.7 Darwin/22.5.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfb6445decef5a4afd41787aa0caca6cda8e8097a6801c358de7c48add996784
|
|
| MD5 |
7bfd56e2ab2607bf6b4abfd4d9d77f7c
|
|
| BLAKE2b-256 |
b97304a315c8a13f8fd096ce3dfd63859e08c67306fca490d466fe4cac765705
|