From 04c01fb606cdd3a51c04d945fc92c673905d6ad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 23 Sep 2019 16:23:14 +0200 Subject: [PATCH] test_argcomplete do not call python directly #5872 Use sys.executable to detect which python we should actually be testing. --- testing/test_parseopt.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/testing/test_parseopt.py b/testing/test_parseopt.py index dd7bc8753..5350974d7 100644 --- a/testing/test_parseopt.py +++ b/testing/test_parseopt.py @@ -298,7 +298,11 @@ def test_argcomplete(testdir, monkeypatch): # redirect output from argcomplete to stdin and stderr is not trivial # http://stackoverflow.com/q/12589419/1307905 # 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 # to handle a keyword argument env that replaces os.environ in popen or # extends the copy, advantage: could not forget to restore