Testing before committing¶
Running tests locally before pushing reduces CI failures and speeds up the review cycle.
Check your Python version¶
OSM requires Python 3.10+:
You can manage Python versions with pyenv.
Install dependencies in a virtual environment¶
cd <osm_project_local_folder>
python -m venv .venv
source .venv/bin/activate
# On Windows PowerShell: .venv\Scripts\Activate.ps1
pip install -r requirements.txt -r requirements-dev.txt -r requirements-test.txt
Run the test suite¶
From the project folder, run:
This is equivalent to running tox directly in most projects. It covers:
- Code format checks
- Linting (pylint, flake8)
- Unit tests with coverage
Run Robot (E2E) tests¶
For more complex changes, you can run the full E2E sanity suite locally using the opensourcemano/tests Docker image:
docker run --rm=true --name tests -t --env-file envconfig.rc \
-v ~/.config/openstack/clouds.yaml:/etc/openstack/clouds.yaml \
-v ~/tests/reports:/robot-systest/reports \
opensourcemano/tests:testing-daily \
-t sanity
See the tests repository README for details on configuring envconfig.rc and available test tags.