# 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
[![asciicast](https://asciinema.org/a/594488.svg)](https://asciinema.org/a/594488)
## 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_on` decorator with kwargs `previous`, `run_last` and `without`.
- `STATUS` classificator. 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 `pySnooper` or `cyberbrain`.
- An `init` command that sets up the tests folder with env subfolder.
Raw data
{
"_id": null,
"home_page": "https://github.com/peteris-zealid/entest",
"name": "entest",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "test,integration-test",
"author": "Peteris Ratnieks",
"author_email": "peteris.ratnieks@zealid.com",
"download_url": "https://files.pythonhosted.org/packages/05/a4/ad61a2441048754f925110db9025c73eac7f07d0087af47bbe242453014e/entest-0.1.16.tar.gz",
"platform": null,
"description": "# Entest\n## God is testing you\nMost of the testing frameworks are pretty old and all of them (python or otherwise) treat unit tests as first class citizens.\nThe ideas of this lib are based on the Testing Trophy. This means that we consider integration tests to be more important.\nThis lib provides a convenient way to explicitly define dependency relationships between tests. Improves transparency of globally needed assets (think fixtures but better).\n\nFor how that would look like practically see `tests/example.py`. This code is referred to in my PyCon talk.\nhttps://www.ganjing.com/video/1fic7807r1p1YVbLCkn4uytkJ1c11c\n\n### Demo\n[![asciicast](https://asciinema.org/a/594488.svg)](https://asciinema.org/a/594488)\n\n## Installing\n```\npip install entest[all]\n```\n\n## Documentation\nSee `tests/example.py`.\n\nTo 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.\n\nTo have all tests implicitly depend on a given test place it closer to the root of the graph.\nUse `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)\n\nTo have a test depend on another test NOT being run use `without` flag. This is usefull for testing error flows.\n\n## Contributing\nPlease do not maintain a fork! Make a pull request and if it is not obviously bad I will merge it in a timely manner.\n\n```\npython3 -m venv .venv\n. .venv/bin/activate\npip install poetry\npoetry install\necho \"\nexport PYTHONPATH=$PWD\nalias entest=\"python3 ./entest/cli.py\"\n\" >> .venv/bin/activate\nexport PYTHONPATH=$PWD\nalias entest=\"python3 ./entest/cli.py\"\n```\n\nI would like to change a lot of things structure-wise, but API will stay the same. In particular:\n- `depends_on` decorator with kwargs `previous`, `run_last` and `without`.\n- `STATUS` classificator. I see how it can be misused easily, but I will still ship this footgun.\n\n## Run tests\n```\nentest --graph\nentest\nentest --skip-teardown\nentest --env env_name tests/example.py --snoop\n```\n\n## Roadmap\n- Better error output with `stackprinter`.\n- Verbose mode that automatically applies `pySnooper` or `cyberbrain`.\n- An `init` command that sets up the tests folder with env subfolder.\n",
"bugtrack_url": null,
"license": "",
"summary": "Write dependent integration tests. See my pycon talk.",
"version": "0.1.16",
"project_urls": {
"Homepage": "https://github.com/peteris-zealid/entest",
"Repository": "https://github.com/peteris-zealid/entest"
},
"split_keywords": [
"test",
"integration-test"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b97304a315c8a13f8fd096ce3dfd63859e08c67306fca490d466fe4cac765705",
"md5": "7bfd56e2ab2607bf6b4abfd4d9d77f7c",
"sha256": "bfb6445decef5a4afd41787aa0caca6cda8e8097a6801c358de7c48add996784"
},
"downloads": -1,
"filename": "entest-0.1.16-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7bfd56e2ab2607bf6b4abfd4d9d77f7c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 10507,
"upload_time": "2023-07-11T10:38:46",
"upload_time_iso_8601": "2023-07-11T10:38:46.840552Z",
"url": "https://files.pythonhosted.org/packages/b9/73/04a315c8a13f8fd096ce3dfd63859e08c67306fca490d466fe4cac765705/entest-0.1.16-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "05a4ad61a2441048754f925110db9025c73eac7f07d0087af47bbe242453014e",
"md5": "55824aa7f7290bf79de29a34acea7721",
"sha256": "442df925a2278a6976f604c397637e60047f6816b3103584e1264e00ec221d2e"
},
"downloads": -1,
"filename": "entest-0.1.16.tar.gz",
"has_sig": false,
"md5_digest": "55824aa7f7290bf79de29a34acea7721",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 9326,
"upload_time": "2023-07-11T10:38:48",
"upload_time_iso_8601": "2023-07-11T10:38:48.171313Z",
"url": "https://files.pythonhosted.org/packages/05/a4/ad61a2441048754f925110db9025c73eac7f07d0087af47bbe242453014e/entest-0.1.16.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-11 10:38:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "peteris-zealid",
"github_project": "entest",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "entest"
}