Skip to content

praisonai test collection requires optional modules in default setup #1541

@Dhivya-Bharathy

Description

@Dhivya-Bharathy

praisonai test collection requires optional modules in default setup

Problem Statement

praisonai tests fail during collection in a base editable install because test/import paths assume optional integrations are installed (praisonaiui, google.generativeai).

Why This Matters

A default dev install should run baseline tests. Optional integrations should not break core test collection.

Environment

  • OS: Windows 10 (build 19045)
  • Python: 3.13.2
  • Repo: MervinPraison/PraisonAI
  • Install mode: editable install without all optional extras

Reproduction (Exact)

  1. Fresh clone + venv.
  2. Install:
    • .venv\Scripts\python -m pip install -e .\src\praisonai
  3. Run:
    • .venv\Scripts\python -m pytest .\src\praisonai\tests -q

🔴 Errors (Observed)

ImportError: praisonaiui is required for PraisonAISessionDataStore.
Install with: pip install 'praisonai[ui]'
ModuleNotFoundError: No module named 'google'

Triggered from code path checking:

  • importlib.util.find_spec("google.generativeai")

Expected Behavior

  • Core test collection should pass in default setup.
  • Optional integration tests should be isolated and skipped unless corresponding extras are installed.

Technical Flow (Current)

flowchart LR
  A[pytest collection] --> B[import test modules]
  B --> C[praisonai.ui._aiui_datastore]
  C --> D[praisonaiui missing]
  B --> E[praisonai.inc.models]
  E --> F[google.generativeai lookup path]
  F --> G[google package missing]
  D --> H[collection failure]
  G --> H
Loading

Suggested Fix Options

  1. Move optional imports behind runtime guards (try/except ImportError) where feasible.
  2. Add pytest markers (e.g., requires_ui, requires_google) and skip when deps are missing.
  3. Add contributor docs:
    • baseline test command
    • full integration test command with extras.

Acceptance Criteria

  • pytest src/praisonai/tests -q collects on base install.
  • Optional-integration tests are clearly reported as skipped when extras are absent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions