Skip to content

Instantly share code, notes, and snippets.

@szabi
Created March 14, 2023 17:36
Show Gist options
  • Save szabi/b4fa87c7a70e83fbaafb32828861209b to your computer and use it in GitHub Desktop.
Save szabi/b4fa87c7a70e83fbaafb32828861209b to your computer and use it in GitHub Desktop.
Accompanying tox issue
REM With single envs it works as expected:
REM expecting: nothing printed, no FAIL
tox -q run -e py310-ok & if ERRORLEVEL 1 echo FAIL
REM (OK) expectation met.
REM expecting FAIL:
tox -q run -e py310-fail & if ERRORLEVEL 1 echo FAIL
REM (OK) expectation met.
REM With multiple envs it does not work as expected!
REM expecting no fail, as ALL environments were ok
tox -q run -e py310-ok,py310-ok2 & if ERRORLEVEL 1 echo FAIL
REM (OK) expectation met.
REM expecting to FAIL as at least one environment has failed:
tox -q run -e py310-ok,py310-fail & if ERRORLEVEL 1 echo FAIL
REM (NOT_OK) expectation *not* met
REM expecting to FAIL as all environments have failed:
tox -q run -e py310-fail,py310-fail2 & if ERRORLEVEL 1 echo FAIL
REM (NOT_OK) expectation *not* met
if __name__ == '__main__':
print("Running main")
[options]
packages = find:
[options.packages.find]
where = .
include = main.py
def test_fail():
assert False
def test_ok():
assert True
[tox]
env_list =
py310-{ok,ok2,fail,fail2}
minversion = 4.4.6
[testenv]
py_modules =
main.py
description = run the tests with pytest
package = wheel
wheel_build_env = .pkg
deps =
pytest
[testenv:py310-ok]
commands =
pytest {tty:--color=yes} test_ok.py {posargs}
[testenv:py310-ok2]
commands =
pytest {tty:--color=yes} test_ok.py {posargs}
[testenv:py310-fail]
commands =
pytest {tty:--color=yes} test_fail.py {posargs}
[testenv:py310-fail2]
commands =
pytest {tty:--color=yes} test_fail.py {posargs}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment