In #235 we introduced a new API which allows clients to spawn a test environment from another python package. In #240 we extended the API so that it also returns the environment info and a cleanup method. It would be good to also provide a wrapper to clients which acts as a context manager so that the cleanup will be invoked automatically when exiting the context manager's scope.
Acceptance Criteria
Implement a context manager which wraps api.spawn_test_environment and cleans the database and test container automatically.
Background
In #235 we introduced a new API which allows clients to spawn a test environment from another python package. In #240 we extended the API so that it also returns the environment info and a cleanup method. It would be good to also provide a wrapper to clients which acts as a context manager so that the cleanup will be invoked automatically when exiting the context manager's scope.
Acceptance Criteria
Implement a context manager which wraps
api.spawn_test_environment
and cleans the database and test container automatically.