Skip to content

[GenAI] Implement Unit Tests for Python Services #76

@GravityDarkLab

Description

@GravityDarkLab

📝 Description

We need to implement unit tests for the GenAI Python-based backend services to ensure stability, correctness, and CI compatibility. All core services (crawler_service.py, embedder_service.py, weaviate_service.py, llm_service.py, and course_generator.py) should be tested in isolation using mocks where external services are involved (e.g., web requests, vector DBs, LLM APIs).

Tests should be runnable both locally and in CI workflows. The goal is to ensure key functionality, error handling, and integration points are covered.

✅ Checklist

  • Setup test structure (e.g., tests/ folder, pytest, etc.)
  • Add unit tests for:
    • crawler_service.py (mock web requests)
    • embedder_service.py (mock model inference)
    • weaviate_service.py (mock DB client interaction)
    • llm_service.py (mock OpenAI or HuggingFace API calls)
    • course_generator.py (test logic that combines the services)
  • Add fixtures and mocks for external calls
  • Add coverage reporting (e.g., via coverage.py)
  • Ensure all tests run via CI
  • Output test summary and coverage % in GitHub Actions summary

📊 Goal

Ensure testability, maintainability, and reliability of the GenAI backend by introducing isolated, repeatable, and verifiable unit tests across all key Python services.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions