aea.test_
tools.utils
Helpful utilities.
wait_
for_
condition
def wait_for_condition(condition_checker: Callable,
timeout: int = 2,
error_msg: str = "Timeout",
period: float = 0.001) -> None
Wait for condition to occur in selected timeout.
consume
def consume(iterator: Iterable) -> None
Consume the iterator
as_
context
@contextmanager
def as_context(*contexts: Any) -> Generator[None, None, None]
Set contexts
copy_
class
def copy_class(cls: Type) -> Type
Copy a class. Useful for testing class setup configurations
remove_
test_
directory
def remove_test_directory(directory: Union[str, Path],
retries: int = 3) -> bool
Destroy a directory once tests are done, change permissions if needed.
Note that on Windows directories and files that are open cannot be deleted.
Arguments:
directory
: directory to be deletedretries
: number of re-attempts
Returns:
whether the directory was successfully deleted