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

Use time_machine for integration tests #500

Closed
willmcgugan opened this issue May 11, 2022 · 3 comments
Closed

Use time_machine for integration tests #500

willmcgugan opened this issue May 11, 2022 · 3 comments

Comments

@willmcgugan
Copy link
Collaborator

We should use the time_machine library to run integration tests involving animation or anything time sensitive. This will allow us to write deterministic tests.

There is a test of animation that we should convert to this.

@olivierphi
Copy link

As per #507 it turns out that we might not need this. time_machine is great for a lot of use cases, but it's probably not the approach to take in the case of Textual.
That's because we not only have to mock the passage of time in the animator as a difference between 2 timestamps (which is where time_machine would shine), but also when we use await asyncio.sleep() (for which time_machine cannot help us).

To be confirmed in the longer term, but it seems that the approach we opted for in #507 (a centralised clock and a centralised set of functions to sleep across the codebase, plus a TestApp that mocks them and keeps their sense of passing time in sync during the integration tests) does the job 🙂 🤞

@willmcgugan
Copy link
Collaborator Author

@github-actions
Copy link

Did we solve your problem?

Glad we could help!

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

No branches or pull requests

2 participants