package tezt
Install
Dune Dependency
Authors
Maintainers
Sources
md5=88c2d9d3da75ff554599bc34cbf5acbe
sha512=e60294514ecc4a989ce663ebb306e56f654dcfaffb7dbe5e3f05f5a13c9c2ff64dadde4a77b0d9a8567a76a6a7a2b25e0940ccd2a956ffcb85ff9300bfebe3bc
doc/tezt.core/Tezt_core/Background/index.html
Module Tezt_core.Background
Source
Promises to run in the background during tests.
Register a promise that will run in the background.
After a test runs, Test.run
waits for all registered promises to finish.
If a registered promise raises an exception which is not Lwt.Canceled
, the current test fails immediately, but Test.run
still waits for other background promises to finish.
Make sure that the promise you register eventually resolves. If it doesn't, stop
(and thus Test.run
, which calls stop
) will hang forever.
Calls to register
when no test is running result in an error.
Allow calls to register
until stop
is called.
If a promise that is later register
ed is rejected by an exception which is not Lwt.Canceled
, start
calls its argument. This may occur several times, including during stop
.
Don't call this directly, it is called by Test.run
.
Let all register
ed promises resolve, then stop allowing calls to register
.
The promise returned by stop
is never rejected except if you cancel it. If you do cancel it, you may have to call stop
again though as it is not guaranteed that all background promises have also been canceled. In other words, canceling the promise returned by stop
is probably a bad idea.
Calling stop
when calls to register
are not allowed has no effect, i.e. you can call stop
even with no corresponding start
.
Don't call this directly, it is called by Test.run
.