test_base.py 506 B

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