From 04579e5a0b5c093778563ae0af8dbe0d68b3b8c8 Mon Sep 17 00:00:00 2001 From: Lanque Date: Tue, 4 Aug 2026 21:53:19 +0300 Subject: [PATCH] Add pytest checks to CI --- .github/workflows/ci.yml | 5 ++++- requirements-dev.txt | 2 ++ tests/test_ai_context.py | 21 +++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 requirements-dev.txt create mode 100644 tests/test_ai_context.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b3ba46..ef365c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: cache: pip - name: Install dependencies - run: python -m pip install -r requirements.txt + run: python -m pip install -r requirements-dev.txt - name: Check Python syntax run: python -m compileall app @@ -33,3 +33,6 @@ jobs: - name: Check dependency consistency run: python -m pip check + + - name: Run tests + run: python -m pytest -q diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..044d133 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,2 @@ +-r requirements.txt +pytest>=8,<9 diff --git a/tests/test_ai_context.py b/tests/test_ai_context.py new file mode 100644 index 0000000..75eb4d0 --- /dev/null +++ b/tests/test_ai_context.py @@ -0,0 +1,21 @@ +from app.services.ai_context import ( + question_is_in_scope, + question_needs_conditions, +) + + +def test_natural_recommendation_question_is_in_scope() -> None: + question = "What is the best location to film at this evening?" + + assert question_is_in_scope(question) + assert question_needs_conditions(question) + + +def test_new_location_recommendation_is_in_scope() -> None: + question = "What location would you recommend adding?" + + assert question_is_in_scope(question) + + +def test_unrelated_question_is_rejected() -> None: + assert not question_is_in_scope("Tell me a joke")