Skip to content

Commit

Permalink
tox: Set --basetemp to work around MAX_PATH limitation on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Oct 5, 2022
1 parent cef3842 commit 9e48d41
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tox.ini
@@ -1,15 +1,33 @@
[tox]
envlist = py37,py38,pypy3,pre-commit
# Platform specification support is available since version 2.0, see:
# https://tox.wiki/en/latest/example/platform.html#basic-multi-platform-example
minversion = 2.0
envlist = {py37,py38,pypy3}-{unix,windows},pre-commit

[testenv]
deps = -rrequirements-dev.txt
passenv = APPDATA HOME LOCALAPPDATA PROGRAMFILES RUSTUP_HOME
platform =
unix: darwin|cygwin|linux\d*|aix\d*|sunos\d*|freebsd\d*
windows: win32
# It's necessary to override the `envtmpdir` because the default one breaks
# some tests. Those tests depend on being run in a directory that is not inside
# a git repository, and the `envtmpdir` defaults to
# `{toxinidir}/.tox/{envname}/tmp` where `toxinidir` also contains a `.git`
# directory.
envtmpdir =
unix: /tmp/pre-commit-{envname}
windows: C:\tmp\pre-commit-{envname}
commands =
coverage erase
coverage run -m pytest {posargs:tests}
coverage run -m pytest --basetemp="{envtmpdir}" {posargs:tests}
coverage report

[testenv:pre-commit]
# We need to set `envtmpdir` because it was set for the `testenv` above. If
# this is omitted, envtmpdir is empty and the whole git repository is deleted
# by tox.
envtmpdir = {envdir}/.tmp
skip_install = true
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure
Expand Down

0 comments on commit 9e48d41

Please sign in to comment.