Skip to content
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

Gut does not stop internal timer after callback. #450

Closed
bitwes opened this issue Dec 2, 2022 · 5 comments
Closed

Gut does not stop internal timer after callback. #450

bitwes opened this issue Dec 2, 2022 · 5 comments
Labels

Comments

@bitwes
Copy link
Owner

bitwes commented Dec 2, 2022

In some complex setups GUT it is possible to cause GUT to yield for less time than it is supposed to. _yielding_callback should call _yield_timer.stop().

@bitwes bitwes added the bug label Dec 2, 2022
@theludovyc
Copy link
Contributor

I made a test on my project https://github.com/theludovyc/Rakugo/blob/a620421257fe4b64e8b084cd26e22b6e5ffb6b9f/Test/TestParser/TestAsk/TestAsk.gd#L12

It passed some times, but often failed.

yield_to never wait time in parameters, even if I set it to 5s. Always instant.

But if I wait the previous signal (like there https://github.com/theludovyc/Rakugo/blob/a620421257fe4b64e8b084cd26e22b6e5ffb6b9f/Test/TestParser/TestSay/TestSay.gd#L12), it never failed.

Can this bug cause that ?

@bitwes
Copy link
Owner Author

bitwes commented Jan 4, 2023

It's possible. You can try the workarounds below to see if it makes the test consistent. I looked back at the code to try and figure out what "complex setups" means, and I can't think of a valid example of when this will happen. I'm sure this is a bug, probably, but I don't know what I found when I made this issue.

You can stop the timer after each test so that the time remaining does not leak into the next test.

func after_each():
    gut._yield_timer.stop()

If you have multiple calls to yield_to in a single test, then you can call gut._yield_timer.stop() after each call to yield_to.

@theludovyc
Copy link
Contributor

I have no problem between test.

Perhaps I expressed myself badly. With a picture it might be better
image

In second case, yield_to never wait time in parameters, even if I set it to 5s. Always instant.

bitwes added a commit that referenced this issue Jan 16, 2024
bitwes added a commit that referenced this issue Jan 16, 2024
@bitwes
Copy link
Owner Author

bitwes commented Jan 16, 2024

Fixed in godot_3x branch.

@bitwes bitwes closed this as completed Jan 16, 2024
@theludovyc
Copy link
Contributor

Thank you 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants