Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions mypy/waiter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@ class LazySubprocess:
"""Wrapper around a subprocess that runs a test task."""

def __init__(self, name: str, args: List[str], *, cwd: str = None,
env: Dict[str, str] = None) -> None:
env: Dict[str, str] = None, passthrough: bool = False) -> None:
self.name = name
self.args = args
self.cwd = cwd
self.env = env
self.start_time = None # type: float
self.end_time = None # type: float
self.passthrough = passthrough

def start(self) -> None:
self.outfile = tempfile.TemporaryFile()
if self.passthrough:
self.outfile = None
else:
self.outfile = tempfile.TemporaryFile()
self.start_time = time.perf_counter()
self.process = Popen(self.args, cwd=self.cwd, env=self.env,
stdout=self.outfile, stderr=STDOUT)
Expand All @@ -47,6 +51,8 @@ def status(self) -> Optional[int]:
return self.process.returncode

def read_output(self) -> str:
if self.passthrough:
return ''
file = self.outfile
file.seek(0)
# Assume it's ascii to avoid unicode headaches (and portability issues).
Expand Down
3 changes: 2 additions & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def add_pytest(self, name: str, pytest_args: List[str], coverage: bool = False)
else:
args = [sys.executable, '-m', 'pytest'] + pytest_args

self.waiter.add(LazySubprocess(full_name, args, env=self.env), sequential=True)
self.waiter.add(LazySubprocess(full_name, args, env=self.env, passthrough=True),
sequential=True)

def add_python(self, name: str, *args: str, cwd: Optional[str] = None) -> None:
name = 'run %s' % name
Expand Down