diff --git a/tests/unitbase.gd b/tests/unitbase.gd index 9d91fda..c6ea399 100644 --- a/tests/unitbase.gd +++ b/tests/unitbase.gd @@ -29,6 +29,8 @@ func after_each() -> void: # Framework management func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void: + if is_framework_loaded(): await unload_framework() + ldiag("Loading framework") core = Core.new(config) get_tree().root.add_child(core) await get_tree().process_frame @@ -36,12 +38,16 @@ func load_framework(config: CoreConfiguration = CoreConfiguration.new()) -> void func unload_framework() -> void: if is_framework_loaded(): + ldiag("Unloading framework") await core.cleanup() get_tree().root.remove_child.call_deferred(core) core = null await get_tree().process_frame + else: lcrash("Can't unload framework: Framework is not loaded") func is_framework_loaded() -> bool: return get_node_or_null("/root/CORE") != null # Helper functions -func wait_process_time() -> void: await get_tree().create_timer(0.1).timeout +func wait_process_time() -> void: + ldiag("Waiting process time") + await get_tree().create_timer(0.1).timeout