zshpytestxdist

OSX. pytest-xdist error in zsh terminal: zsh: no matches found: 3*popen


I am using ZSH + iterm as a command line tool. When I am trying to run pytest tests with xdist plugin in several subprocesses I get an error: no matches found: 3*popen

Execution command: pytest --tx 3*popen --dist=load

Additional info:

OS version: OSX 10.13.2

Pytest: 3.4.0

Terminal: Iterm + ZSH


Solution

  • Try quoting *. For example:

    pytest --tx 3\*popen --dist=load
    

    or

    pytest --tx '3*popen' --dist=load
    

    By default zsh prints an error if it cannot match a filename pattern (while bash would just leave the pattern unchanged). Quoting glob operators, like *, prevents their evaluation, allowing to use them verbatim.


    It would also be possible to make zsh behave like bash by disabling the NOMATCH option with setopt no_nomatch. Personally, I would recommend against it, as it could lead to unexpected results in case there are actually matching file names.