base.py 775 B

1234567891011121314151617181920212223242526272829303132
  1. from abc import ABC, abstractmethod
  2. from pydantic import BaseModel
  3. from openhands.events.event import Event
  4. from openhands.runtime.base import Runtime
  5. class TestResult(BaseModel):
  6. success: bool
  7. reason: str | None = None
  8. class BaseIntegrationTest(ABC):
  9. """Base class for integration tests."""
  10. INSTRUCTION: str
  11. @classmethod
  12. @abstractmethod
  13. def initialize_runtime(cls, runtime: Runtime) -> None:
  14. """Initialize the runtime for the test to run."""
  15. pass
  16. @classmethod
  17. @abstractmethod
  18. def verify_result(cls, runtime: Runtime, histories: list[Event]) -> TestResult:
  19. """Verify the result of the test.
  20. This method will be called after the agent performs the task on the runtime.
  21. """
  22. pass