diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 62e32d1f..4dce9f34 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 6d545289..72a0dc4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/server/pytest.ini b/server/pytest.ini index 7c1d8c1a..993fa8c8 100644 --- a/server/pytest.ini +++ b/server/pytest.ini @@ -1,5 +1,7 @@ [pytest] -testpaths = . +testpaths = tests +rootdir=server +consider_namespace_packages = True python_files = test_*.py cov=com cov-report=xml,html diff --git a/server/routers/__init__.py b/server/routers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/server/tests/__init__.py b/server/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/server/test_main.py b/server/tests/test_main.py similarity index 91% rename from server/test_main.py rename to server/tests/test_main.py index 9f3561cf..3526ddef 100644 --- a/server/test_main.py +++ b/server/tests/test_main.py @@ -1,5 +1,5 @@ from fastapi.testclient import TestClient -from .main import app +from ..main import app client = TestClient(app)