You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the project you are working on: Goost Godot Engine extension.
Describe the problem or limitation you are having in your project:
I happen to write unit test in GDScript using GUT, and this works well for most cases. I also want to test for failure paths from within GDScript itself for best coverage (like testing bad index to prevent crashes). The problem is that these kind of erroneous operations produce error prints in the debugger and console:
functest_choice_empty():
# Should not crash.assert_null(Random.choice(""))
assert_null(Random.choice([]))
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
I propose adding a method which allows to dynamically enable and disable error printing. Having ability to temporarily disable those errors allows to filter out the noise coming from "expected failures" seen in tests.
I've even written unit testing documentation describing this technique in Testing failure paths section when writing unit tests in C++. The same thing should be possible to do from within Godot to work both in the console and the editor.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
The approach would be similar to existing ERR_PRINT_ON and ERR_PRINT_OFF test macros in tests/test_macros.h. The method can be added to OS singleton, such as OS::set_error_print_enabled(). The missing part is that it should also apply to Godot's debugger in the editor.
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Impossible to prevent error prints in the debugger selectively. It's possible to disable error printing via application/run/disable_stderr project setting, but that only prevents terminal output, and the idea here is that it should be possible to do this at run-time as well.
Is there a reason why this should be core and not an add-on in the asset library?:
Can only be done on the engine level.
The text was updated successfully, but these errors were encountered:
Maybe this should be a property in the Engine singleton which can be set at run-time?
Engine.print_errors = true/false
Xrayez
changed the title
Add a method to temporarily disable error printing in the engine
Add a way to temporarily disable error printing in the engine
Nov 3, 2020
Describe the project you are working on:
Goost Godot Engine extension.
Describe the problem or limitation you are having in your project:
I happen to write unit test in GDScript using GUT, and this works well for most cases. I also want to test for failure paths from within GDScript itself for best coverage (like testing bad index to prevent crashes). The problem is that these kind of erroneous operations produce error prints in the debugger and console:
The above problem can be seen in goostengine/goost#31.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
I propose adding a method which allows to dynamically enable and disable error printing. Having ability to temporarily disable those errors allows to filter out the noise coming from "expected failures" seen in tests.
I've even written unit testing documentation describing this technique in Testing failure paths section when writing unit tests in C++. The same thing should be possible to do from within Godot to work both in the console and the editor.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
The approach would be similar to existing
ERR_PRINT_ON
andERR_PRINT_OFF
test macros intests/test_macros.h
. The method can be added toOS
singleton, such asOS::set_error_print_enabled()
. The missing part is that it should also apply to Godot's debugger in the editor.If this enhancement will not be used often, can it be worked around with a few lines of script?:
Impossible to prevent error prints in the debugger selectively. It's possible to disable error printing via
application/run/disable_stderr
project setting, but that only prevents terminal output, and the idea here is that it should be possible to do this at run-time as well.Is there a reason why this should be core and not an add-on in the asset library?:
Can only be done on the engine level.
The text was updated successfully, but these errors were encountered: