Skip to content

Commit

Permalink
Add pytest to project
Browse files Browse the repository at this point in the history
  • Loading branch information
sternakt committed Jan 3, 2025
1 parent f8dae11 commit 9339f5e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Run Pytest

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run pytest
run: pytest tests/
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ lint = [
"codespell==2.3.0",
]

testing = []
testing = [
"pytest==8.3.4",
"pytest-asyncio==0.25.0",
]

dev = [
"realtime-over-websockets[type,lint,testing]",
Expand Down
11 changes: 11 additions & 0 deletions tests/test_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from fastapi.testclient import TestClient

from realtime_over_websockets.main import app

client = TestClient(app)


def test_index_page():
response = client.get("/")
assert response.status_code == 200
assert response.json() == {"message": "WebSocket Audio Stream Server is running!"}

0 comments on commit 9339f5e

Please sign in to comment.