Skip to content

Latest commit

Β 

History

History
59 lines (53 loc) Β· 1.72 KB

README.md

File metadata and controls

59 lines (53 loc) Β· 1.72 KB

Python Unittest

β”œβ”€β”€ gradlew
β”œβ”€β”€ gradlew.bat
β”œβ”€β”€ pytest.ini
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ src
β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  β”œβ”€β”€ all-commands.sh
β”‚Β Β  β”œβ”€β”€ bucket-api
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ bucket-api-template.yaml
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ deploy.sh
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ main.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ requirements.txt
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ tests
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── test_bucket_api.py
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ upload-test.txt
β”‚   β”œβ”€β”€ pubsub-api
β”‚   β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”‚   β”œβ”€β”€ deploy.sh
β”‚   β”‚   β”œβ”€β”€ pubsub-api-template.yaml
β”‚   β”‚   β”œβ”€β”€ pubsub_api_main.py
β”‚   β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”‚   └── test_pubsub_api.py
PROJECT_ID="<your-project-id>"
pytest
# or ./gradlew test

gladle clean

GOOGLE_APPLICATION_CREDENTIALS, GCS_BUCKET_NAME, and GOOGLE_CLOUD_PROJECT environment variables are used with default('D:') option in setup.cfg. So if you want to test in src/bucket-api or src/pubsub-api path, .sa file should be created in each foler.

[flake8]
max-line-length = 200
ignore = F123, E456
exclude = .terraform

[tool:pytest]
log_cli=True
log_cli_level=DEBUG
; --html=report.html = pip install pytest-html
addopts=--failed-first --cov=src/bucket-api --cov=src/pubsub-api --junit-xml=build/test-result.xml --html=build/test-report.html --cov-report=xml:build/test-coverage.xml 
junit_family=legacy
; --cov-branch 
; norecursedirs=.pyenv-python
env =
    D:GOOGLE_APPLICATION_CREDENTIALS=.sa
    D:GCS_BUCKET_NAME={PROJECT_ID}-bucket-api
    D:GOOGLE_CLOUD_PROJECT={PROJECT_ID}