-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asynchronous tests are broken #114
Comments
I agree this should work. The issue is not only the |
Another solution is to modify tests like this: function testBar(async: utest.Async) {
var thread = Thread.current();
veryComplexFunctionToBeTested(() -> {
thread.events.run(() -> {
utest.Assert.pass();
async.done();
});
});
} |
Thank you for your comments. |
Just create a class with the same package and name in your project. |
Maybe not related to this, but also probably is, so I didn't want to open a new issue: async in setupClass blocks even after async.done() has been called, but only if it's been called from a Timer or Thread callback. For example, running this test:
will not fail as expected, instead it will just hang forever:
|
Environment
macos monterey 12.1
haxe 4.2.4
utest 1.13.2
Asynchronous tests don’t work when they happen to run on threads without event loop. The problem lies in the object
haxe.Timer
, used internally by utest, which throws the exception NoEventLoopException when it is called from a thread without an event loop. The error affects all the threaded targets (I’ve tried with java, cs and python). You may find useful this discussion on the same problem.Is it possible to use another implementation of timer, for example haxe-concurrent, instead of that of the standard library?
The issue can be reproduced by the following code
The reported error is
The text was updated successfully, but these errors were encountered: