test_argcomplete do not call python directly #5872

Use sys.executable to detect which python we should actually be testing.
This commit is contained in:
Tomáš Chvátal 2019-09-23 16:23:14 +02:00
parent 1b4ad7774b
commit 04c01fb606
No known key found for this signature in database
GPG Key ID: E4A2468C8EEE3BE8
1 changed files with 5 additions and 1 deletions

View File

@ -298,7 +298,11 @@ def test_argcomplete(testdir, monkeypatch):
# redirect output from argcomplete to stdin and stderr is not trivial # redirect output from argcomplete to stdin and stderr is not trivial
# http://stackoverflow.com/q/12589419/1307905 # http://stackoverflow.com/q/12589419/1307905
# so we use bash # so we use bash
fp.write('COMP_WORDBREAKS="$COMP_WORDBREAKS" python -m pytest 8>&1 9>&2') fp.write(
'COMP_WORDBREAKS="$COMP_WORDBREAKS" {} -m pytest 8>&1 9>&2'.format(
sys.executable
)
)
# alternative would be exteneded Testdir.{run(),_run(),popen()} to be able # alternative would be exteneded Testdir.{run(),_run(),popen()} to be able
# to handle a keyword argument env that replaces os.environ in popen or # to handle a keyword argument env that replaces os.environ in popen or
# extends the copy, advantage: could not forget to restore # extends the copy, advantage: could not forget to restore