https://github.com/noahgift/pytest-from-ground-zero
This is a new pytest repo that covers the best practices
https://github.com/noahgift/pytest-from-ground-zero
Last synced: 4 months ago
JSON representation
This is a new pytest repo that covers the best practices
- Host: GitHub
- URL: https://github.com/noahgift/pytest-from-ground-zero
- Owner: noahgift
- License: cc0-1.0
- Created: 2022-05-12T12:28:07.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-12T21:03:34.000Z (over 3 years ago)
- Last Synced: 2025-04-08T14:25:14.657Z (6 months ago)
- Language: Python
- Size: 31.3 KB
- Stars: 12
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/noahgift/pytest-from-ground-zero/actions/workflows/build.yml)
[
# pytest-from-ground-zero
This is a new pytest repo that covers the best practices## Note on Virtualenv
Checkout how if you run `pip freeze | wc -l` there are many package you may not want
Try `which python`1. `virtualenv ~/.venv`
2. `vim ~/.bashrc` and put in `source ~/.venv/bin/activate`
3. Verify the right python `which python` and try `pip freeze | wc -l`## Testing for Multi-Cloud
* AWS Cloud Shell
## Using PyTest
* Use library style: `python -m pytest -vv --cov=mylib testing/`
* Run tests by keyword expressions: `python -m pytest -vv -k "search"`
* To run a specific test within a module: `python -m pytest -vv testing/test_fruity.py::test_random_fruit`
* Run tests by marker expressions: https://docs.pytest.org/en/7.1.x/how-to/mark.html#mark
* Profile tests: `pytest --durations=10 --durations-min=1.0`
* Skipping `@pytest.mark.skip(reason="no way of currently testing this")`
* [Checkout Fixtures here](https://paiml.com/docs/home/books/testing-in-python/chapter07-pytest-fixtures/)### Distributed Testing
* install: https://pypi.org/project/pytest-xdist/#installation
### AWS Code Build
* Easy because we leveraged `makefile`: [buildspec.yml](https://github.com/noahgift/pytest-from-ground-zero/blob/main/buildspec.yml)
### References
* [Watch on O'Reilly: Cloud Native Pytest Tips and Tricks from Ground Zero](https://learning.oreilly.com/videos/cloud-native-pytest/05122022VIDEOPAIML/)
* [Watch on YouTube: Cloud Native Pytest Tips and Tricks from Ground Zero ](https://www.youtube.com/watch?v=EOCtbjuICbA)