6

Looking on the tox global settings section from tox documentation, the .tox directory which is working dir, is created in directory where tox.ini is located:

toxworkdir={toxinidir}/.tox(PATH)
    Directory for tox to generate its environments into, will be created if 
    it does not exist.

Is there a way to change this location?

For instance, I have a project as follows:

awesome_project/
├── main.py
├── src
│   └── app.py
└── tox.ini

I want to execute tox.ini from awesome_project dir, but want to write .tox dir in /tmp/.tox not in awesome_project/.tox.

Thanks for help.

brxie
  • 107
  • 1
  • 7

2 Answers2

8

{toxinidir}/.tox is just a default value that you can change in tox.ini:

[tox]
toxworkdir=/tmp/.tox
phd
  • 82,685
  • 13
  • 120
  • 165
  • 1
    Thanks a lot. It's working. There is also possible set this location per specific environment using envdir variavle. – brxie Sep 28 '18 at 08:00
  • 1
    If you have two unrelated projects which use the same toxworkdir, this will cause you trouble. And all files in /tmp get removed after a reboot (at least on linux). I would suggest /var/tmp/MY_PROJECT/.tox – guettli Aug 04 '22 at 07:55
1

You can change the working directory from the command line:

tox --workdir /tmp/.tox

It may be useful if you want to use the same tox.ini file in two different computers with different working directories.

Erel Segal-Halevi
  • 33,955
  • 36
  • 114
  • 183