I am currently working with girder and for my unit tests I have the following scope use cases :
- function scope (current girder fixture scope) : Test different file parsing and associated state on the data base. Usually loads a few files at a time and is relatively fast.
- module scope : Setup a data base once for the module to test some processing with the data as it is loaded on the data base. Setups whole DICOM volumes and sometimes adds in some post processing.
- session scope : Integration or end to end tests requiring a complex test data base but which only needs to be loaded once. Setups a complex database with full post processing features.
As of now the implementation of the fixtures limits their usage to function scope. I was wondering what your thoughts were on using a different implementation for these fixtures to let the user have more flexibility on how they use it. Here are some implementations which would permit user defined scopes :
- Add dynamic scoping with option scope parameter (which would enabling grouping the scope of the database using the conftest.py file)
- Split the implementation into functions and helper functions using context manager. This in turn would enable a user to create their fixture with the following syntaxe :
with pytest_girder.fixture_helpers.configure_db(request) as db :
# Further config