test_base.py 504 B

1234567891011121314151617181920
  1. from typing import Optional
  2. import pytest
  3. from r2r import R2RException
  4. class BaseTest:
  5. """Base class for all test classes with common utilities."""
  6. @staticmethod
  7. async def cleanup_resource(
  8. cleanup_func, resource_id: Optional[str] = None
  9. ) -> None:
  10. """Generic cleanup helper that won't fail the test if cleanup fails."""
  11. if resource_id:
  12. try:
  13. await cleanup_func(id=resource_id)
  14. except R2RException:
  15. pass