Add ability to test asynchronous actions. #12
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #5.
Now, if you need to test that something asynchronous happens,
you can call
@ctx.wait_for_action("my action")
to let the testrunner know that the test isn't over until the action completes.
After the asynchronous action is finished, you can mark it as such
by calling
@ctx.finished_action("my action")
to let the testrunner know that the action is complete.
You can add new actions to wait for at any time during a test,
but the names must be unique in order for them to be differentiated.
Once all awaited actions are marked as finished, the asynchronous
test example is done running.
If one or more actions don't get marked as finished in a timely manner,
an informational message will be printed every 5 seconds for all open
actions that are still being awaited.
The whole test suite will time out after 30 seconds.
These time intervals will be able to be configured at runtime
using the constant override mechanism mentioned in this ticket:
savi-lang/savi#161