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