Show More
@@ -28,6 +28,7 b' from IPython.utils.py3compat import decode' | |||
|
28 | 28 | from IPython.utils.sysinfo import get_sys_info |
|
29 | 29 | from IPython.utils.tempdir import TemporaryDirectory |
|
30 | 30 | from pathlib import Path |
|
31 | from typing import Dict | |
|
31 | 32 | |
|
32 | 33 | class TestController: |
|
33 | 34 | """Run tests in a subprocess |
@@ -37,7 +38,7 b' class TestController:' | |||
|
37 | 38 | #: list, command line arguments to be executed |
|
38 | 39 | cmd = None |
|
39 | 40 | #: dict, extra environment variables to set for the subprocess |
|
40 | env = None | |
|
41 | env: Dict[str, str] = {} | |
|
41 | 42 | #: list, TemporaryDirectory instances to clear up when the process finishes |
|
42 | 43 | dirs = None |
|
43 | 44 | #: subprocess.Popen instance |
@@ -69,6 +70,8 b' class TestController:' | |||
|
69 | 70 | c.start() |
|
70 | 71 | stdout = c.writefd if capture_output else None |
|
71 | 72 | stderr = subprocess.STDOUT if capture_output else None |
|
73 | for k, v in env.items(): | |
|
74 | assert isinstance(v, str), f"env[{repr(k)}] is not a str: {v}" | |
|
72 | 75 | self.process = subprocess.Popen(self.cmd, stdout=stdout, |
|
73 | 76 | stderr=stderr, env=env) |
|
74 | 77 | |
@@ -149,7 +152,7 b' class PyTestController(TestController):' | |||
|
149 | 152 | PATH = noaccess / PATH |
|
150 | 153 | else: |
|
151 | 154 | PATH = noaccess |
|
152 |
self.env[ |
|
|
155 | self.env["PATH"] = str(PATH) | |
|
153 | 156 | |
|
154 | 157 | # From options: |
|
155 | 158 | if self.options.xunit: |
@@ -190,11 +193,11 b' class PyTestController(TestController):' | |||
|
190 | 193 | data_file=Path(f".coverage.{self.section}").absolute(), |
|
191 | 194 | source="\n ".join(sources), |
|
192 | 195 | ) |
|
193 | config_file = Path(self.workingdir.name) / ".coveragerc" | |
|
196 | config_file: Path = Path(self.workingdir.name) / ".coveragerc" | |
|
194 | 197 | config_file.touch(exist_ok=True) |
|
195 | 198 | config_file.write_text(coverage_rc) |
|
196 | 199 | |
|
197 | self.env["COVERAGE_PROCESS_START"] = config_file.resolve() | |
|
200 | self.env["COVERAGE_PROCESS_START"] = str(config_file.resolve()) | |
|
198 | 201 | self.pycmd = "import coverage; coverage.process_startup(); " + self.pycmd |
|
199 | 202 | |
|
200 | 203 | def launch(self, buffer_output=False): |
General Comments 0
You need to be logged in to leave comments.
Login now