Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

pytest Example

A simple Python calculator demonstrating pytest with HTML report generation for Gaffer.

Setup

# Create virtual environment (optional but recommended)
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Running Tests

# Run tests (basic)
pytest

# Run tests with HTML report
pytest --html=reports/pytest-report.html --self-contained-html

Report Output

  • pytest HTML: reports/pytest-report.html

Uploading to Gaffer

Using curl

curl -X POST https://app.gaffer.sh/api/upload \
  -H "X-API-Key: $GAFFER_UPLOAD_TOKEN" \
  -F "files=@reports/pytest-report.html"

Using GitHub Action

See .github/workflows/pytest.yml for the full workflow.