1

Within a tox.ini (tox 3.25.1) I am trying to run cd to create a link

[testenv:docs]
commands =
    make clean
    make html SPHINXOPTS="-v"
    cd build/html
    ln -s ../../source/www/projects .
allowlist_externals = 
    make 
    /bin/bash

But neither

allowlist_externals = 
    /bin/bash

nor

allowlist_externals = 
    bash

nor

allowlist_externals = 
    cd

seem to work. I always get the error

ERROR: InvocationError for command could not find executable cd

So what is the trick? And where is it documented?

As this documentation seems to be outdated or incorrect.

The linked answer HERE seems to be completely unrelated. I do not want to change the directory in which tox is executed. Please read.

Alex
  • 41,580
  • 88
  • 260
  • 469
  • `cd` is not an external command. What exactly are you hoping to accomplish? Running `cd` in a subprocess is pointless anyway, as it cannot change the current directory of its parent process (in this case, `tox`). – tripleee Jul 19 '22 at 12:30
  • As you can see in the question I want to create a link – Alex Jul 19 '22 at 12:31
  • 1
    Simply `ln -s ../../source/www/projects build/html/` should work. The first argument to `ln -s` can be anything, the symlink will only be resolved when you attempt to open it (and so any relative path should be relative to the link's location, not the directory where you run the command, perhaps confusingly). – tripleee Jul 19 '22 at 12:38
  • 1
    For these type of things, I would put the commands (`make`, `cd`, `ln`) into a shell script and run the script from tox. – user1934428 Jul 19 '22 at 12:42
  • Never mind, you suggestion for `ln` seems to work now. I wonder why the full path ln (ln -s /home/me/folder/here/and/there ...) does not work. – Alex Jul 19 '22 at 12:43
  • Perhaps that path is not part of the virtual envrionment created by tox? – user1934428 Jul 19 '22 at 12:46
  • But still - the documentation does not seem to be correct. Do you agree? – Alex Jul 19 '22 at 12:48

0 Answers0