@@ -299,15 +299,12 @@ def test_argcomplete(testdir, monkeypatch):
299299 if not distutils .spawn .find_executable ("bash" ):
300300 pytest .skip ("bash not available" )
301301 script = str (testdir .tmpdir .join ("test_argcomplete" ))
302- pytest_bin = sys .argv [0 ]
303- if "pytest" not in os .path .basename (pytest_bin ):
304- pytest .skip ("need to be run with pytest executable, not {}" .format (pytest_bin ))
305302
306303 with open (str (script ), "w" ) as fp :
307304 # redirect output from argcomplete to stdin and stderr is not trivial
308305 # http://stackoverflow.com/q/12589419/1307905
309306 # so we use bash
310- fp .write ('COMP_WORDBREAKS="$COMP_WORDBREAKS" %s 8>&1 9>&2' % pytest_bin )
307+ fp .write ('COMP_WORDBREAKS="$COMP_WORDBREAKS" python -m pytest 8>&1 9>&2' )
311308 # alternative would be exteneded Testdir.{run(),_run(),popen()} to be able
312309 # to handle a keyword argument env that replaces os.environ in popen or
313310 # extends the copy, advantage: could not forget to restore
@@ -323,7 +320,11 @@ def test_argcomplete(testdir, monkeypatch):
323320 # argcomplete not found
324321 pytest .skip ("argcomplete not available" )
325322 elif not result .stdout .str ():
326- pytest .skip ("bash provided no output, argcomplete not available?" )
323+ pytest .skip (
324+ "bash provided no output on stdout, argcomplete not available? (stderr={!r})" .format (
325+ result .stderr .str ()
326+ )
327+ )
327328 else :
328329 result .stdout .fnmatch_lines (["--funcargs" , "--fulltrace" ])
329330 os .mkdir ("test_argcomplete.d" )
0 commit comments