Tests were failing with ModuleNotFoundError: No module named 'azure.storage' because the conda environment was missing some dependencies.
Installed the required packages in the conda environment:
azure-storage-blob==12.24.1azure-identity==1.20.0rq==1.15.1
Updated test files to gracefully handle missing optional dependencies by mocking them:
backend/open_webui/test/apps/webui/workers/test_file_processor.pytest_worker_cleanup_verification.py
Created backend/open_webui/test/apps/webui/workers/conftest.py to:
- Register custom pytest markers (
@pytest.mark.workers,@pytest.mark.integration) - Remove pytest warnings about unknown markers
✅ All 6 pytest tests now pass:
test_session_cleanup_called_on_success- PASSEDtest_session_cleanup_called_on_error- PASSEDtest_embedding_function_cleanup- PASSEDtest_file_processing_job_structure- PASSEDtest_mock_request_cleanup_pattern- PASSEDtest_multiple_jobs_cleanup- PASSED
# Activate conda environment
conda activate rit4test
# Run all worker tests
pytest backend/open_webui/test/apps/webui/workers/test_file_processor.py -v
# Run standalone verification
python test_worker_cleanup_verification.py- Tests use mocks for most dependencies, so they don't require actual Redis/DB connections
- Optional storage provider dependencies (Azure, GCS) are mocked if not installed
- All tests verify that cleanup code (
Session.remove()andEMBEDDING_FUNCTIONcleanup) is properly executed