Improve document stores unit test parametrization #1202
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes:
Parametrizes document store tests allowing developers to select a subset of document stores in the generic document store related tests.
This is just a preview and request for feedback. Only test/test_retriever.py tests have been updated for this preview. Updating other tests is trivial given this approach is approved.All relevant generic document store tests have been updated.To run tests for all document stores, an explicit parametrize annotation marker with a list of all document stores needs to be removed from a unit test function (see diff). However, we want to leave a particular explicit parametrize annotation in some test cases as the test might test a particular functionality for a specific document store.
To try out an updated test approach, we'll focus on test_dpr_embedding test in test_retriever.py
To run tests for all document stores, no changes in pytest command invocation are needed. That remains a default option.
To run a particular test or a subset of tests with a desired document store type a developer needs to add a command-line parameter. For example, to run test for faiss only one should invoke this command:
One can also run a test on a subset of document stores:
Resolves #1108
Looking forward to your feedback.
Status (please check what you already did):