Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.69 KB

File metadata and controls

52 lines (38 loc) · 1.69 KB

Test Fixes Summary

Issue

Tests were failing with ModuleNotFoundError: No module named 'azure.storage' because the conda environment was missing some dependencies.

Fixes Applied

1. Installed Missing Dependencies

Installed the required packages in the conda environment:

  • azure-storage-blob==12.24.1
  • azure-identity==1.20.0
  • rq==1.15.1

2. Added Optional Dependency Handling

Updated test files to gracefully handle missing optional dependencies by mocking them:

  • backend/open_webui/test/apps/webui/workers/test_file_processor.py
  • test_worker_cleanup_verification.py

3. Added Pytest Configuration

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

Test Results

All 6 pytest tests now pass:

  1. test_session_cleanup_called_on_success - PASSED
  2. test_session_cleanup_called_on_error - PASSED
  3. test_embedding_function_cleanup - PASSED
  4. test_file_processing_job_structure - PASSED
  5. test_mock_request_cleanup_pattern - PASSED
  6. test_multiple_jobs_cleanup - PASSED

Running Tests

# 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

Notes

  • 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() and EMBEDDING_FUNCTION cleanup) is properly executed