Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-line option for overriding toxworkdir #20

Closed
pytoxbot opened this issue Sep 17, 2016 · 11 comments
Closed

Command-line option for overriding toxworkdir #20

pytoxbot opened this issue Sep 17, 2016 · 11 comments

Comments

@pytoxbot
Copy link

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.

@pytoxbot
Copy link
Author

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.

@pytoxbot
Copy link
Author

Original comment by @aconrad

+1 to override this setting with an environment variable. Issue up-voted.

@pytoxbot
Copy link
Author

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 {{{/.tox}}} to {{{~/.cache/tox/}}}: i have a small shell function helper to do this for new checkouts.

@obestwalter
Copy link
Member

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 :)

@xsteadfastx
Copy link

toxworkdir={env:TOX_WORK_DIR:.tox}

this is such a great workaround. thank you a thousand times.

@jaraco
Copy link

jaraco commented Aug 15, 2020

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.

@jaraco
Copy link

jaraco commented Oct 21, 2020

I could have used this feature for #1706 also. Use-case: VM with host file system mounted.

@jaraco
Copy link

jaraco commented Oct 21, 2020

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 ~.

@gaborbernat
Copy link
Member

This will be possible with the rewrite branch.

@jayvdb
Copy link

jayvdb commented Oct 22, 2020

@jaraco ~ isnt part of tox syntax. Try {homedir}.

jaraco added a commit to python/importlib_resources that referenced this issue Oct 22, 2020
@jaraco
Copy link

jaraco commented Oct 22, 2020

That worked. I'm going to add the workaround to all of my tox ini files.

jaraco added a commit to python/importlib_resources that referenced this issue Oct 22, 2020
jaraco added a commit to jaraco/skeleton that referenced this issue Nov 20, 2020
clrpackages pushed a commit to clearlinux-pkgs/jaraco.functools that referenced this issue Jan 5, 2021
…version 3.1.0

Jason R. Coombs (36):
      Remove tox-venv and tox-pip-version. Tox-venv is discouraged (tox-dev/tox-venv#48 (comment)) and tox-pip-version was only there to support tox-venv. venv is dead; long live virtualenv.
      Remove more references to tox-venv
      Add workaround for warning emitted when junitxml is used. Ref pytest-dev/pytest#6178.
      Include mypy for type checking during tests.
      Ensure virtualenv is upgraded when installing tox. Fixes jaraco/path#188.
      Run tests on prereleases of Python on Windows. Fixes jaraco/skeleton#17.
      Add workaround for python/mypy#8627. Fixes jaraco/skeleton#18.
      Add 'refresh.svg' demonstrating an example of refreshing a project with the latest skeleton. Ref #7.
      Move workaround for python/mypy#8627 to tox.ini, as adding it to setup.cfg prevents releases to PyPI. Fixes jaraco/skeleton#19.
      Remove workaround for python/mypy#8627. Ref jaraco/skeleton#18.
      Create Github releases when releasing the package. Fixes jaraco/skeleton#23.
      Moved refresh.svg to another branch. Reference the animation from the docs. Ref jaraco/skeleton#7.
      Add the env var mapping too.
      Disable pytest-black and pytest-mypy on PyPy. Fixes jaraco/skeleton#22. Ref pytest-dev/pytest#7675.
      Bump black and blacken-docs to latest stable versions.
      Use enabled plugin configuration to enable mypy and black when the plugin is present. Ref jaraco/skeleton#22.
      Also enable flake8 and cov when the plugins are present.
      Fix mypy glitch on __path__.
      Add workflows for running tests. Ref jaraco/skeleton#24.
      Cut releases from Github Actions instead of Azure Pipelines. Ref jaraco/skeleton#24.
      Refresh docs to prefer Github Actions to Azure Pipelines. Ref jaraco/skeleton#24.
      Use RTD v2 config
      Test on Python 3.9. Skip 3.7 to avoid creating too many builds. Release on 3.9.
      Drop tests on Travis, Appveyor, and Azure Pipelines.
      use add-github-secrets, which infers the secrets needed from the github workflow.
      Use inline flags with local scope.
      Honor TOX_WORK_DIR if set. Workaround for tox-dev/tox#20.
      Fix badge
      Collapse skeleton history from archive/2020-12
      Update skeleton description to describe the periodic collapse. Fixes #27.
      Enable automerge
      Add except_ decorator.
      Following move to Github actions, port the expected failing test also.
      🧎‍♀️ Genuflect to the types.
      🧎‍♀️ Genuflect to the types.
      Pass the GITHUB_ACTIONS
clrpackages pushed a commit to clearlinux-pkgs/keyring that referenced this issue Jan 5, 2021
…21.7.0

Jason R. Coombs (12):
      Move Tidelift release note publishing to Github Actions.
      Honor TOX_WORK_DIR if set. Workaround for tox-dev/tox#20.
      Add a Dockerfile on Windows
      Fix rendering of README.
      Extract _detect_backend function.
      Collapse skeleton history from archive/2020-12
      Update skeleton description to describe the periodic collapse. Fixes #27.
      Enable automerge
      Update changelog. Ref #480.
      Update readme to reflect more recent practices relying on Github Actions.
      Restore tests now that they're no longer failing. Fixes #436.
      Declare typing support. Fixes #437.

Thomas Kluyver (1):
      Initialise backend on first use instead of on import
@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants