test_matrix: Run Python subprocess via sys.executable.

This works better with pytest on Windows.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-08-24 16:50:57 -07:00
parent b02b84204a
commit cb00a29311

View file

@ -1,5 +1,6 @@
import os import os
import shutil import shutil
import sys
from contextlib import contextmanager from contextlib import contextmanager
from subprocess import PIPE, Popen from subprocess import PIPE, Popen
from tempfile import mkdtemp from tempfile import mkdtemp
@ -41,7 +42,7 @@ def new_temp_dir() -> Iterator[str]:
class MatrixBridgeScriptTests(TestCase): class MatrixBridgeScriptTests(TestCase):
def output_from_script(self, options: List[str]) -> List[str]: def output_from_script(self, options: List[str]) -> List[str]:
popen = Popen( popen = Popen(
["python", script] + options, stdin=PIPE, stdout=PIPE, universal_newlines=True [sys.executable, script] + options, stdin=PIPE, stdout=PIPE, universal_newlines=True
) )
return popen.communicate()[0].strip().split("\n") return popen.communicate()[0].strip().split("\n")