@@ -299,15 +299,12 @@ def test_argcomplete(testdir, monkeypatch):
299
299
if not distutils .spawn .find_executable ("bash" ):
300
300
pytest .skip ("bash not available" )
301
301
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 ))
305
302
306
303
with open (str (script ), "w" ) as fp :
307
304
# redirect output from argcomplete to stdin and stderr is not trivial
308
305
# http://stackoverflow.com/q/12589419/1307905
309
306
# 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' )
311
308
# alternative would be exteneded Testdir.{run(),_run(),popen()} to be able
312
309
# to handle a keyword argument env that replaces os.environ in popen or
313
310
# extends the copy, advantage: could not forget to restore
@@ -323,7 +320,11 @@ def test_argcomplete(testdir, monkeypatch):
323
320
# argcomplete not found
324
321
pytest .skip ("argcomplete not available" )
325
322
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
+ )
327
328
else :
328
329
result .stdout .fnmatch_lines (["--funcargs" , "--fulltrace" ])
329
330
os .mkdir ("test_argcomplete.d" )
0 commit comments