Skip to content

Commit

Permalink
Switch to tox 4 (#1020)
Browse files Browse the repository at this point in the history
* Update tox.ini to work with tox 4

- remove `skipsdist = True` (tox 4 will not install bandit with this setting, not even in editable mode for environments where `usedevelop = True` is set), add `skip_install = true` to the pep8 job
- remove `requires = tox<4`
- use multi-line list for `passenv`
- add the `-` mark to ignore pylint exit code in the pep8 job - although this mark is already present in `[testenv:pylint]`, tox 4 ignores it when using the `{[testenv:pylint]commands}` substitution

* Use the `tox run` command

In tox 4, environments should always be specified using the -e flag to the `run` subcommand. https://tox.wiki/en/4.4.11/upgrading.html#updating-usage-with-e
  • Loading branch information
mportesdev committed Apr 13, 2023
1 parent c4da1cb commit 0342c33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e format
run: tox run -e format

pep8:
runs-on: ubuntu-latest
Expand All @@ -45,7 +45,7 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e pep8
run: tox run -e pep8

tests:
strategy:
Expand All @@ -70,4 +70,4 @@ jobs:
pip install -r test-requirements.txt
pip install tox
- name: Run tox
run: tox -e py${{ matrix.python-version[1] }}
run: tox run -e py${{ matrix.python-version[1] }}
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ You can test any changes with tox:

```shell script
pip install tox
tox -e pep8
tox -e py37
tox -e docs
tox -e cover
tox run -e pep8
tox run -e py37
tox run -e docs
tox run -e cover
```
If everything is done, proceed with [opening a new pull request](https://help.github.com/en/desktop/contributing-to-projects/creating-a-pull-request)

Expand Down
14 changes: 9 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[tox]
minversion = 3.2.0
envlist = py37,pep8
skipsdist = True
requires =
tox<4

[testenv]
usedevelop = True
Expand All @@ -18,7 +15,13 @@ commands =
stestr run {posargs}
allowlist_externals =
find
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
passenv =
http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY

[testenv:debug]
commands = oslo_debug_helper -t tests {posargs}
Expand All @@ -31,13 +34,14 @@ commands = flake8 {posargs} bandit
bandit-baseline -r bandit -ll -ii

[testenv:pep8]
skip_install = true
ignore_errors = true
deps = {[testenv]deps}
.
usedevelop = False
commands = flake8 {posargs} bandit
flake8 {posargs} tests
{[testenv:pylint]commands}
-{[testenv:pylint]commands}
bandit-baseline -r bandit -ll -ii

[testenv:venv]
Expand Down

0 comments on commit 0342c33

Please sign in to comment.