Skip to content

[BUG] test_langflow_components.py imports missing praisonai_task — wrapper unit collection aborts when Langflow installed #5361

Description

@Dhivya-Bharathy

[BUG] test_langflow_components.py imports missing praisonai_task module — wrapper unit collection aborts when Langflow is installed

Metadata

Field Value
Repository https://github.com/MervinPraison/PraisonAI
Commit tested 5c7d76d72 (main, 2026-09-29)
Labels bug, tests, langflow, ci
Severity High — pytest src/praisonai/tests/unit exits 2; ~6k tests not collected
Component src/praisonai/tests/unit/test_langflow_components.py
Missing module praisonai.flow.components.PraisonAI.praisonai_task

Executive summary

When Langflow is installed (optional extra in pyproject.toml), pytest collection loads test_langflow_components.py. The file passes pytest.importorskip("langflow") then immediately imports:

from praisonai.flow.components.PraisonAI.praisonai_task import PraisonAITaskComponent

On current main, praisonai_task.py does not exist. Only these ship under praisonai/flow/components/PraisonAI/:

  • praisonai_agent.py
  • praisonai_agents.py

Collection fails with ModuleNotFoundError, pytest interrupts the entire wrapper unit tree (exit code 2), so most of src/praisonai/tests/unit never runs on developer machines that have Langflow (common when using Langflow/LFX tooling).

This is repo/test drift, not an environment misconfiguration.


Expected vs actual

Expected Actual
Langflow optional tests skip or pass when extras installed Collection ERROR if Langflow present
Shipped components match test imports Test imports non-existent praisonai_task
pytest src/praisonai/tests/unit completes Interrupted after 1 collection error

Terminal evidence (2026-09-29, Windows, Python 3.13, no OpenAI key)

$ pytest src/praisonai/tests/unit -q --tb=line
collected 6042 items / 1 error / 7 skipped

ERROR collecting src/praisonai/tests/unit/test_langflow_components.py
ImportError while importing test module '.../test_langflow_components.py'.
src/praisonai/tests/unit/test_langflow_components.py:4: in <module>
    from praisonai.flow.components.PraisonAI.praisonai_task import PraisonAITaskComponent
E   ModuleNotFoundError: No module named 'praisonai.flow.components.PraisonAI.praisonai_task'

!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
============= 7 skipped, 1 warning, 1 error in 393.79s (0:06:33) =============
exit code: 2

Root cause

  1. Missing implementation: praisonai_task.py (and PraisonAITaskComponent) not present on main.
  2. Test still references it at module import time (lines 4, 26–43, 53–58).
  3. importorskip("langflow") is insufficient — it only skips when Langflow is absent; when Langflow is installed, the broken import runs during collection.

Suggested fix (pick one)

A. Restore component — Add praisonai/flow/components/PraisonAI/praisonai_task.py implementing PraisonAITaskComponent (if product intent).

B. Remove/update test — Drop task component tests or rewrite to use only shipped components until task component lands.

C. Defensive import — Lazy-import inside tests or:

pytest.importorskip("langflow")
praisonai_task = pytest.importorskip("praisonai.flow.components.PraisonAI.praisonai_task")

D. CI matrix — Run wrapper unit tests with and without [langflow] extra; fail if collection errors.


Acceptance criteria

  • pytest src/praisonai/tests/unit completes collection with Langflow installed (no exit 2)
  • test_langflow_components.py either passes or is skipped with clear reason
  • Document Langflow optional path in contributor docs

Workaround (local audit)

pytest src/praisonai/tests/unit --ignore=src/praisonai/tests/unit/test_langflow_components.py

Or uninstall Langflow so importorskip("langflow") skips the module (hides the product gap).


Duplicate search

gh search issues --repo MervinPraison/PraisonAI "praisonai_task langflow" → no matches (2026-09-29).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclaudeAuto-trigger Claude analysisdocumentationImprovements or additions to documentation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions