| 306 | |
| 307 | |
| 308 | class CapturedResults(namedtuple('CapturedResults', 'stdout stderr exc')): |
| 309 | |
| 310 | class Proxy: |
| 311 | def __init__(self, capturing): |
| 312 | self._capturing = capturing |
| 313 | def _finish(self): |
| 314 | if self._capturing is None: |
| 315 | return |
| 316 | self._final = self._capturing.final() |
| 317 | self._capturing = None |
| 318 | def __iter__(self): |
| 319 | self._finish() |
| 320 | yield from self._final |
| 321 | def __len__(self): |
| 322 | self._finish() |
| 323 | return len(self._final) |
| 324 | def __getattr__(self, name): |
| 325 | self._finish() |
| 326 | if name.startswith('_'): |
| 327 | raise AttributeError(name) |
| 328 | return getattr(self._final, name) |
| 329 | |
| 330 | def raise_if_failed(self): |
| 331 | if self.exc is not None: |
| 332 | raise interpreters.ExecutionFailed(self.exc) |
| 333 | |
| 334 | |
| 335 | def _captured_script(script, *, stdout=True, stderr=False, exc=False): |
no test coverage detected
searching dependent graphs…