In certain circumstances it would be very useful to override the setting of toxworkdir. For instance, in a CI environment such as Bamboo where each job of a build plan is run in it's own directory, it would be very useful to have toxworkdir point somewhere outside of the individual job directories in order to avoid repeated rebuilds of the virtual environments when the package list changes. Having toxworkdir be overridable means that the setting in tox.ini could be used as a default which is then overridden in the CI environment.
Original comment by @witten
Not ideal, but here's a work-around:
toxworkdir={env:TOX_WORK_DIR:.tox}
A similar hack also works for envdir.
Original comment by @aconrad
+1 to override this setting with an environment variable. Issue up-voted.
Original comment by pi_byteorbit
Being able to override the default value with an environment variable would also be great.
My use case: I have one or two dozen projects checked out on my development machine, and their collection of {{{.tox}}} directories can grow pretty huge: many gigabytes, spread out over many directories. I would really like a way to be able to point them all at a common local place, outside of the individual project checkouts, to make them easier to manage.
At the moment, my workaround is to symlink {{{
Anyone opposed to closing this as wontfix? The issue is open since 2011 and we haven't been flooded with PRs for this, so the pain can't be too big :)
toxworkdir={env:TOX_WORK_DIR:.tox}
this is such a great workaround. thank you a thousand times.
I'd like to +1 this feature request. I've got a use-case where I'm running tests in a docker container - I want to mount the source code on the host machine and test it in the container, but I don't want to re-use the tox work dir of the host machine. I want the guest to have its own work dir. I'd like in the environment for --workdir=/.tox to be the default. An environment variable would be perfect for this need. The tox.ini:toxworkdir workaround doesn't help here because the tox.ini is shared with the host and isn't local to the environment.
I could have used this feature for #1706 also. Use-case: VM with host file system mounted.
Not ideal, but here's a work-around:
toxworkdir={env:TOX_WORK_DIR:.tox}
Sadly, this technique doesn't work when a ~ is included in the TOX_WORK_DIR. In that case, tox fails to expand the user's home dir:
importlib_resources bugfix/bpo-41490 # $TOX_WORK_DIR='~/local/tox'
importlib_resources bugfix/bpo-41490 # tox -e py35
py35 create: C:\Users\jaraco\p\importlib_resources\~\local\tox\py35
Perhaps it's a separate issue that toxworkdir doesn't expand ~.
This will be possible with the rewrite branch.
@jaraco ~ isnt part of tox syntax. Try {homedir}.
That worked. I'm going to add the workaround to all of my tox ini files.
Most helpful comment
Original comment by @witten
Not ideal, but here's a work-around:
A similar hack also works for
envdir.