-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
changedir breaks script discovery #2089
Comments
Yeah, you definitely want to do this.
The script is |
Can you post a tox 3 run that shows it works? |
Thanks for the prompt response! This also happens with [testenv:script]
changedir = doc
allowlist_externals = my_script.bat
commands = my_script.bat And I want to reiterate that it worked without the extension when |
Another thing came to mind: it of course works on Linux because |
So just to confirm the script above works on tox 3 but doesn't with tox 4? |
I started narrowing it down a bit, but couldn't find a version that works.
I'll try the 4.0 branch next. |
Ah, ok then. The scripts are executed and discovered after the changedir is executed. If you do changedir you'd want to specify scripts relative, or better don't really on relative scripts, make them absolute: [testenv:script]
changedir = doc
commands = {toxinidir}{/}my_script.bat |
Hmm okay, I can get it to work sometimes, but not in the case you presented: ; Works:
changedir = doc
allowlist_externals = my_script
commands = doc/my_script
; Works:
commands = doc/my_script
; Does NOT work:
changedir = doc
commands = {toxinidir}{/}my_script.bat
; results in InvocationError, exit code 2 and the path references the top dir, not doc
; Works:
changedir = doc
commands = {toxinidir}{/}doc/my_script.bat
; Works:
commands = {toxinidir}{/}doc/my_script.bat
; Does NOT work:
changedir = doc
commands = {toxinidir}{/}doc/my_script
; InvocationError, exit code 2 and the path is weird: ...\top\doc/my_script Should this information be included in the documentation then? I was very confused, and this helped a lot. Although I don't fully understand the difference between the various runs above, I think at least including something about running scripts would be helpful. I guess the ones without |
Actually, reading your last comment, what do you mean by relative exactly? Because now they need to be relative to the initial directory, even though they are discovered after executing the changedir. I'd expect |
Seems scripts are discovered relative to toxinidir, not the cwd (which is altered by changedir). We can't really change this without breaking a lot of people. In general though my recommendation is to use the |
I understand that, and it's an acceptable solution to me. But would it be a possibility in Tox 4? I'd be happy to contribute such documentation if you'd accept it! |
For sure, though tox 4 documentation is still WIP and I'm currently caught up with doing a POC for PEP-662, so might take a few weeks until we're ready to accept that. |
I meant documentation for Tox 3 for now. Then depending on whether this is changed or left as it is in Tox 4 is up to you, and the documentation can be moved over or updated. How does that sound? |
I think this can be closed now! |
Thanks for your contribution! |
Hi, firstly thanks for providing Tox. It's awesome! I also saw the PyCon talk about Tox 4 and I'm really looking forward to it 😄
I've created an env for building Sphinx documentation with its make scripts. I know the documentation suggests using
sphinx-build
directly but anyways: the script cannot be found under the directory.Output of
tox -e script -rvv
Environment: Windows 10, Python 3.9.4, virtualenv, tox 3.23.1
I also had a dummy project with a
setup.py
file just for installing the package.For the reasons above, I posted this as a bug. But feel free to correct me if I'm simply doing something wrong!
The text was updated successfully, but these errors were encountered: