Run tests
OpenGateLLM uses a combination of unit and integration tests to ensure the quality of the code.
Directoryapi/
Directorytests/
Directoryunit/
- …
Directoryintegration/
- …
Unit tests
Section titled “Unit tests”Unit tests are located in the tests/unit folder. They are written using the pytest framework.
-
Create a Python virtual environment (recommended)
-
Install the dependencies with the following command:
Terminal window pip install ".[api,test]" -
To run the tests, you can use the following command:
Terminal window make test-unit
Integration tests
Section titled “Integration tests”Integration tests are located in the tests/integration folder. They are written using the pytest framework and Docker compose to run the API and its dependencies in Docker containers.
-
Create a Python virtual environment (recommended)
-
Install the dependencies with the following command:
Terminal window pip install ".[api,test]" -
To run the tests, you can use the following command:
Terminal window make test-integration
To run the tests with VSCode, you can create a .vscode/settings.json file with the following content:
{ "python.terminal.activateEnvironment": true, "python.testing.pytestArgs": [ "api", "-s", "--config-file=pyproject.toml" ], "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, "python.envFile": "${workspaceFolder}/.github/.env.ci" }