Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ You need to install ``tox`` (``pip3 install tox``) to run tests and lint checks
# run unit tests in one python environment only (useful for quick testing during development):
tox -e py311

# run a specific unit test file:
tox -e py311 -- tests/unit/objects/test_projects.py

# run unit and smoke tests in one python environment only
tox -e py312,smoke

Expand Down Expand Up @@ -148,9 +151,15 @@ To run these tests:
# run the CLI tests:
tox -e cli_func_v4

# run a specific CLI functional test file:
tox -e cli_func_v4 -- tests/functional/cli/test_cli_v4.py

# run the python API tests:
tox -e api_func_v4

# run a specific API functional test file:
tox -e api_func_v4 -- tests/functional/api/test_projects.py

When developing tests it can be a little frustrating to wait for GitLab to spin
up every run. To prevent the containers from being cleaned up afterwards, pass
``--keep-containers`` to pytest, i.e.:
Expand Down
22 changes: 17 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ passenv =
NO_COLOR
PWD
PY_COLORS
USER
setenv =
DOCS_SOURCE = docs
DOCS_BUILD = build/sphinx/html
Expand All @@ -35,10 +36,13 @@ usedevelop = True
install_command = pip install {opts} {packages} -e .
isolated_build = True


[testenv:py{314,313,312,311,310}]
description = Runs unit tests. For a specific test: tox -e py311 -- <path>
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-test.txt
commands =
pytest tests/unit {posargs}
pytest {posargs:tests/unit}

[testenv:black]
basepython = python3
Expand Down Expand Up @@ -115,6 +119,8 @@ deps = -r{toxinidir}/requirements-docs.txt
commands = sphinx-autobuild {env:DOCS_SOURCE} {env:DOCS_BUILD} --open-browser --port 8000

[testenv:cover]
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/requirements-test.txt
commands =
pytest --cov --cov-report term --cov-report html \
--cov-report xml tests/unit {posargs}
Expand All @@ -131,14 +137,20 @@ exclude_lines =
return NotImplemented

[testenv:cli_func_v4]
deps = -r{toxinidir}/requirements-docker.txt
description =
Runs CLI functional tests. For a specific test: tox -e cli_func_v4 -- <path>
deps = -r{toxinidir}/requirements-test.txt
-r{toxinidir}/requirements-docker.txt
commands =
pytest --script-launch-mode=subprocess --cov --cov-report xml tests/functional/cli {posargs}
pytest --script-launch-mode=subprocess --cov --cov-report xml {posargs:tests/functional/cli}

[testenv:api_func_v4]
deps = -r{toxinidir}/requirements-docker.txt
description =
Runs API functional tests. For a specific test: tox -e api_func_v4 -- <path>
deps = -r{toxinidir}/requirements-test.txt
-r{toxinidir}/requirements-docker.txt
commands =
pytest --cov --cov-report xml tests/functional/api {posargs}
pytest --cov --cov-report xml {posargs:tests/functional/api}

[testenv:smoke]
deps = -r{toxinidir}/requirements-test.txt
Expand Down
Loading