Skip to content

Commit

Permalink
feat: init pytest workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RaoHai committed Aug 21, 2024
1 parent 99bdebc commit 64db783
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ on:
- petercat_utils/**
- subscriber/**

defaults:
run:
working-directory: ./server

jobs:
build:
runs-on: ubuntu-latest
environment: production
strategy:
fail-fast: true
defaults:
run:
working-directory: ./server


steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ packages = [{include = "petercat_utils"}]
[tool.ruff]
builtins = ["_"]

[pytest]
testpaths = ["tests"]
rootdir = "server"
pythonpath = "server"
consider_namespace_packages = "True"
python_files = "test_*.py"
cov="com"
cov-report=["xml","html"]

[tool.poetry.dependencies]
python = "^3.8"
langchain_community = "^0.2.11"
Expand Down
4 changes: 3 additions & 1 deletion server/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[pytest]
testpaths = .
testpaths = tests
rootdir=server
consider_namespace_packages = True
python_files = test_*.py
cov=com
cov-report=xml,html
Empty file added server/routers/__init__.py
Empty file.
Empty file added server/tests/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion server/test_main.py → server/tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from fastapi.testclient import TestClient
from .main import app
from ..main import app

client = TestClient(app)

Expand Down

0 comments on commit 64db783

Please sign in to comment.