Files
langflow/.github/workflows
Yuqi Tang 3d7ad8b088 feat: Adding backend unit tests (#9416)
* Add comprehensive unit tests for Celery modules (celery_app.py and celeryconfig.py)

- Add test_celery_app.py with 10 unit tests covering make_celery function
- Add test_celeryconfig.py with 14 unit tests covering configuration validation
- All tests use proper mocking to avoid external dependencies
- Achieve 100% test pass rate (24/24 tests)
- Improve test coverage from 0% to meaningful levels for core Celery functionality
- Fix linting issues: combine nested with statements and optimize startswith calls

* fix: Resolve linting issues in utility test files

- Remove unused variables and function arguments
- Fix boolean positional arguments in test calls
- Combine nested with statements
- Fix string literals in exception messages
- Add missing newlines at end of files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add comprehensive unit tests for backend modules

This commit adds focused unit test coverage for critical backend components
with meaningful test implementations:

API Layer:
- AsyncStreamingLLMCallbackHandleSIO callback handler tests
- WebSocket streaming, agent actions, and error handling

Components:
- NotifyComponent initialization and configuration tests
- PythonCodeStructuredTool component structure and build tests

Services:
- SocketIOService session management and event handling tests
- S3StorageService AWS operations and error handling tests

Utils:
- async_helpers: AsyncLock, async utilities, and error handling
- component_utils: Component operations and data processing
- compression: Response compression and encoding utilities
- concurrency: Thread management and parallel processing
- lazy_load: Module lazy loading and import optimization
- payload: Data transformation and API payload handling
- schemas: Data validation and schema verification
- version: Version parsing and compatibility checking
- voice_utils: Audio processing and voice feature utilities

All tests include comprehensive mocking, error scenarios, edge cases,
and integration patterns following pytest best practices. Removed
placeholder functions and kept only meaningful test implementations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix linting issues in test_data_structure.py and test_util.py

- Fix boolean positional value warnings with noqa comments
- Replace string literals in exceptions with variables
- Combine nested with statements
- Remove unused variables and function arguments
- Use proper parameter names with underscores for unused args

All ruff checks now pass for these test files.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* merge conflicts

* Add comprehensive unit tests for logic components

- Added test_conditional_router.py with 51 tests for ConditionalRouterComponent
- Added test_data_conditional_router.py with 53 tests for DataConditionalRouterComponent
- Added test_listen.py with 22 tests for ListenComponent
- Added test_notify_component.py with 12 tests for NotifyComponent
- Added test_pass_message.py with 16 tests for PassMessageComponent
- Added test_flow_tool.py with 17 tests for FlowToolComponent

Total: 171 comprehensive tests covering initialization, functionality, edge cases, and error handling
All tests follow clean code practices and achieve high coverage

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* merge conflict

* merge conflict

* fix import errors in unit tests

* fix ruff errors

* [autofix.ci] apply automated fixes

* update path for test_graph in smoke tests

* fix smoke test and failing tests

* modify smoke tests paths

* run lfx tests separately

* fix test_conditional_router.py

* [autofix.ci] apply automated fixes

* fix FlowToolComponent tests

* [autofix.ci] apply automated fixes

* fix: Ensure CLI error output is visible in tests

- Fix error messages not appearing in test output when stdout is redirected
- Temporarily restore stdout before writing error JSON to ensure visibility
- Fix overly broad test condition that matched 'langflow' in file paths
- Only check for actual langflow/lfx import errors, not dependency errors

Fixes 3 failing tests in test_run_starter_projects.py:
- News Aggregator.json
- Pokédex Agent.json
- Price Deal Finder.json

All 736 LFX tests now pass.

* [autofix.ci] apply automated fixes

* Revert "fix: Ensure CLI error output is visible in tests"

This reverts commit 390c669043.

* fix: Correct import paths in test_concurrency.py

* fix test_voice_utils

* fix test_util

* [autofix.ci] apply automated fixes

* fiix test_util

* [autofix.ci] apply automated fixes

* fix test_voice_util.py

* unused args:

* refactor tests to use componentclient

* [autofix.ci] apply automated fixes

* fix ruff errors in test_flow_tool

* skip if api key is not present

* make workflow more robust

* fix mocking in test_celery_app

* [autofix.ci] apply automated fixes

* add celery

* add removed files back

* include once functional

* skip celery tests

* review comments addressed

* remove celery from dependency

* change env var validation

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: himavarshagoutham <himavarshajan17@gmail.com>
Co-authored-by: Himavarsha <40851462+HimavarshaVS@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-10-16 16:46:26 +00:00
..
2025-10-16 16:46:26 +00:00