Skip to content

v9.3.0

Latest
Compare
Choose a tag to compare
@bitwes bitwes released this 25 Jul 15:21
· 7 commits to main since this release
6fc7c17

9.3.0

Features

  • You can Monkey Patch your doubles! You can make any method in a double call a specified Callable using .to_call(callable) on stub. Details are on the Stubbing wiki page.
var dbl = double(MyScript)
stub(dbl.some_method).to_call(func(): print("Monkey Patched!"))
  • You can now use callables to stub insetad of passing the object and method name. Binding arguments adds an implicit when_passed to the stub. Less strings, less typing!
var dbl = double(MyScript)
# same as stub(dbl, "some_method").to_return(111)
stub(dbl.some_method).to_return(111)

# same as stub(dbl, 'some_method').to_return(999).when_passed("a")
stub(dbl.some_method.bind("a")).to_return(999)
  • @WebF0x GUT can now wait on a Callable to return true (aka predicate method) via the new wait_until:
# Call the function once per frame until it returns 5 or one second has elapsed.
await wait_until(func(): return randi_range(0, 20)==5, 1)
  • wait_for_signal and the new wait_until return true if they did not timeout, and false otherwise. This means waiting on, and asserting a signal has been emitted can now be written as
assert_true(await wait_for_signal(my_obj.my_singal, 2),
    'signal should emit before 2 seconds')
  • @mphe GUT now automatically enables the "Exclude Addons" option when running tests. This means you don't have to keep enabling/disabling this option if GUT does not conform to your warning/error settings.
  • GUT disables warnings at key points in execution and then re-enables them. This makes running GUT possible (or at least easier) with warning levels incompatable with GUT source code. This also makes the ouput less noisy.
  • @plink-plonk-will Elapsed time is now included in the XML export.
  • Issue #612 InputSender now sets the button_mask property for generated mouse motion events when mouse buttons have been pressed but not released prior to a motion event.
  • Issue #598 Added the virtual method should_skip_script to GutTest. If you impelement this method and return true or a String, then GUT will skip the script. Skipped scripts are marked as "risky" in the final counts. This can be useful when skipping scripts that should not be run under certiain circumstances such as:
    • You are porting tests from 3.x to 4.x and you don't want to comment everything out.
    • Skipping tests that should not be run when in headless mode.
    func should_skip_script():
        if DisplayServer.get_name() == "headless":
            return "Skip Input tests when running headless"
    • If you have tests that would normally cause the debugger to break on an error, you can skip the script if the debugger is enabled so that the run is not interrupted.
    func should_skip_script():
        return EngineDebugger.is_active()
  • The CLI got an update to its Option Parser. There's more info in #623:
    • options that take a value can now be specified with a space (option value) instead of using option=value.
    • -gh option now has headings for the different options. It looks a lot better.
    • -gdir and -gtest can be specified multiple times instead of using a comma delimited list.
    • You can use -gconfig= to not use a config file.
  • Minor niceties such as showing that GUT is exiting in the title bar (takes a bit sometimes) and switching to full display at the end of a run if GUT does not automatically exit.

Bug Fixes

  • Issue #601 doubles now get a resource path that makes Godot ignore them when "Exclude Addons" is enabled (res://adddons/gut/not_a_real_file/...).
  • Issue #594 An error is generated if GUT cannot find the double template files. This can happen if you export your game with tests, but do not include *.txt files.
  • Issue #595 When no tests are run GUT no longer displays "All Tests Passed!" and exits (based off of settings).
  • Issue #578 Fix InputSender so it works with Input.is_action_just_pressed, Input.is_action_just_released and Input.is_action_pressed. Thanks @lxkarp and @Edearth for you work on this.

Deprecations

  • The optional GutTest script variable skip_script has been deprecated. Use the new should_skip_script method instead.
  • GUT now warns if you have overridden _ready in your test script without calling super._ready.

New Contributors

Full Changelog: v9.2.1...v9.3.0