It would be useful to have a -C option (like make) to change to a specified directory before reading the tox.ini file.
@philtay tox has -c which IIUC is basically doing that aleady only that you have to give the path to the config file instead of the directory where the config is located. Would that already solve your problem?
There is also a changedir option that could be used inside the tox.ini if that helps.
Otherwise it would be helpful if you explain your use case in a bit more detail, so that we can see if it really would make sense to have -C additionally to the existing options.
I know about -c, but I don't want to specify a full config file path, only the "target" directory. With -C (uppercase) tox would be looking for a standard tox.ini inside the specified directory. The use-case is running tox from a Makefile: currently the only way is cd /mydir && tox (or having to specify a full path when the filename tox.ini is essentially a given).
I know about -c, but I don't want to specify a full config file path, only the "target" directory.
So basically -c almost does what you want, but you don't want to have to explicitly pass the name of tox.ini - which is reasonable as this is in 99% of the cases the name of the tox config.
How about changing the behaviour of the -c option that if you point to a directory tox.ini is assumed as the name of the config?
That would be your -C option without having to add another option. This is a reasonably simple change without breaking backwards compatibility unless there are workflows who rely on getting an error if a path to a directory instead of a filepath is passed, but for me that would fall into the area of relevant XKCD.
I guess, a PR with that change would be accepted.
Hah nice reference!
(currently at home with a stomach bug, so this kind of reference is a plus 馃榿 )
@obestwalter Yes, your idea would solve the problem. Nice XKCD!
Is anyone working on this feature? I would be happy to do a PR if not.
And just to reiterate- tox -c relative/path should have the same behaviour as tox -c relative/path/tox.ini, right?
@pawelad I'm not working on it, please go ahead. Thanks.
The specified path can be absolute or relative. If path is a regular file just stick with the current behaviour. If path is a directory then path = os.path.join(path, 'tox.ini').
PR (#472) submitted - sorry it took so long : -)
10 days are nothing in the great scheme of things. Thanks for joining in :)
My pleasure : )
PR was merged, I believe this can be closed now.
Yes thanks, fixed by #472