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

Improve resource cleanup #7

Open
ctron opened this issue Nov 3, 2021 · 0 comments
Open

Improve resource cleanup #7

ctron opened this issue Nov 3, 2021 · 0 comments

Comments

@ctron
Copy link
Member

ctron commented Nov 3, 2021

Currently we create some resources, but have issues cleaning them up properly. This is due to different idea of different creates we use for testing.

Test dependencies are:

  • rstest – For parametrized tests
  • test-context – For managing test state

However, rstest and test-context conflict. Also see: la10736/rstest#94

Resources are:

  • WebDriver instance
  • Applications and devices created using drg
  • Applications and devices created using the API

Some of the resources are managed async, and need to be cleaned up async. Some of them are managed sync.

Cleaning up via Drop would be ok, but Drop is tricky to use with async. But this is how we currently clean up the WebDriver, to ensure that it is freed.

One way to deal with this could be to create some kind of Resource<T> wrapper, which you can explicitly drop/destroy. But which is also registered with the test context, to schedule cleanup for the end of the test. When using the test-context crate, this could automatically be cleaned up (async). However, when using rstest based tests, this doesn't work.

Ideally, we would find a way to combine rstest and test-context.

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

1 participant