Closed adadgio closed 2 weeks ago
Hello,
this is a Godot related issue, sometimes the console is not flashing the output.
To avoid this, you need to add an await get_tree().process_frame
after your print statement.
e.g.
func test_do_something() -> void:
# remove this line and complete your test
print("Hello world")
await get_tree().process_frame
assert_that(1).is_equal(1)
You should also check your stdout settings
The GdUnitConsole
shows only test reports and no stdout statements.
Regards Mike
Makes sense, works on successful tests assertions... Thanks!
A have a question about mocking autoload singletons and methods, which I couldn't do despite the docs. Where you I ask about that ?
A have a question about mocking autoload singletons and methods, which I couldn't do despite the docs. Where you I ask about that ?
Mocking a autoload is not possible because autoloads are singletons and by default a single instance.
Sorry, I meant stub a autoload method. Doing do_return on an autoloaded singleton is not possible ?
Sorry, I meant stub a autoload method. Doing do_return on an autoloaded singleton is not possible ?
Please do not ask not issue related questions here, please use the discussions or join the Discord server for direct help.
This is technical, not possible. The autoload instance is loaded by Godot and hold by a singleton instance. You can't build a mock/stub of this, this would need technical to replace the original instance and this is not possible.
The used GdUnit4 version
4.3.4 (Latest Release)
The used Godot version
v4.3
Operating System
Mac OS Sonoma
Describe the bug
In tests, the print() statement does not print anything in the Ouput tab nor in the GDUnit console. Not sure if this should be reporterd as or intended feature, but that would be very usefull nonetheless to debug tests.
Steps to Reproduce
Write any test and write a print("Anything you want") statement.
Minimal reproduction project
gdunitprintbugreport.zip