Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onramplab/pytest-starter
https://github.com/onramplab/pytest-starter
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/onramplab/pytest-starter
- Owner: OnrampLab
- Created: 2024-03-06T06:59:39.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-11-04T03:55:00.000Z (14 days ago)
- Last Synced: 2024-11-04T04:26:35.800Z (14 days ago)
- Language: Python
- Size: 56.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pytest-starter
## Set up project
## Install package manager - poetry
```bash
docker-compose build
```## Install packages
### Copy config
```
cp config.yml.example config.yml
cp .env.example .env
```## Running tests
```
python -m pytest tests/test_registration.py
``````
python -m pytest tests/
``````
python -m pytest -s tests/test_contact_report.py
```To generate xml results, run the following command : `pytest Tests --junitxml="result.xml"`
For more on Pytest, go [here.](https://docs.pytest.org/en/stable/)
## Clear cache
Windows
```
Remove-Item -Recurse -Force .pytest_cache
```## CI/CD
### Encrypt config.yml to AWS S3 for staging or production
Prerequisites:
1. You need to create a KMS key in AWS.
2. Update aws setting in `pytest.ini`
3. You can create `config.yml.dev`, `config.yml.staging` and `config.yml.production`. And then doing encryption before running CI/CD pipeline.
4. Do encryption
```bash
$ export KMS_KEY_ID="your_kms_key_id"
$ docker-compose run app python tools/scripts/encrypt_config.py [Environment]
```Environment will be:
- `dev`: for feature branch
- `staging` for master branch
- `production` for tagIt will create a S3 file object under `pytest/encrypted_config.yml` of S3 bucket.
Production uses `starter` bucket. Staging uses `starter-staging` bucket.
## Contribution
```
git checkout YOUR_BRANCH
git add .
git commit -m "YOUR_MESSAGE"
git push origin YOUR_BRANCH
```