Conftest
This module configures pytest options and fixtures for testing.
It includes a command line option to specify the model name for tests and a fixture to retrieve the model name from the command line options. The model name is used for loading pre-trained sentence transformer models during testing.
The default model is 'sentence-transformers/all-MiniLM-L6-v1', which provides a good balance between performance and resource usage for testing purposes.
model_name
¶
Fixture to retrieve the model name from the command line options.
This fixture provides access to the model name specified via the --model command line option. If no model is specified, it returns the default 'sentence-transformers/all-MiniLM-L6-v1'.
PARAMETER | DESCRIPTION |
---|---|
request
|
The request object providing access to the test context and command line options.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The model name specified in the command line options or the default value. The model name is typically in the format 'sentence-transformers/model-name'.
TYPE:
|
Source code in tests/conftest.py
pytest_addoption
¶
Add a command line option to specify the model name for tests.
This function adds the '--model' option to pytest's command line interface, allowing users to specify which sentence transformer model to use during testing.
PARAMETER | DESCRIPTION |
---|---|
parser
|
The pytest command line argument parser.
TYPE:
|
Example
pytest --model "sentence-transformers/all-mpnet-base-v2"