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

Shared fixtures / fixture scope? #18

Open
jackfirth opened this issue Nov 13, 2017 · 0 comments
Open

Shared fixtures / fixture scope? #18

jackfirth opened this issue Nov 13, 2017 · 0 comments
Labels

Comments

@jackfirth
Copy link
Owner

A test case using a fixture and containing nested test cases results in a different instance of the fixture for each nested test case. But sometimes a fixture should be shared between all the tests, such as a fixture for an expensive resource that's safe to access concurrently by independent clients (such as a pool of connections to a service used by tests).

Test cases could possibly provide a #:singleton or #:shared keyword that can be used after a fixture clause to trigger this behavior. But some fixtures almost always want to be shared, and callers would have to use the keyword every time they used the fixture.

Alternatively, fixtures could be defined with some sort of "scope" value attached that defines when new values are allocated and when they're reused. Some sort of "test module scope" could mean that all test cases in the same module reuse the fixture value, and some sort of "place scope" could mean that all test cases in the same place should reuse the fixture value. That would require some sort of integration with test runners. Much thinking to do here.

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

1 participant