MCPcopy
hub / github.com/pex-tool/pex / IntegResults

Class IntegResults

testing/__init__.py:403–466  ·  view source on GitHub ↗

Convenience object to return integration run results.

Source from the content-addressed store, hash-verified

401
402@attr.s(frozen=True)
403class IntegResults(object):
404 """Convenience object to return integration run results."""
405
406 cmd = attr.ib() # type: Tuple[str, ...]
407 output = attr.ib() # type: Text
408 error = attr.ib() # type: Text
409 return_code = attr.ib() # type: int
410
411 @property
412 def exe(self):
413 # type: () -> str
414 return self.cmd[0]
415
416 @property
417 def interpreter(self):
418 # type: () -> PythonInterpreter
419 return PythonInterpreter.from_binary(self.exe)
420
421 @property
422 def target(self):
423 # type: () -> LocalInterpreter
424 return LocalInterpreter.create(self.exe)
425
426 @property
427 def pex(self):
428 # type: () -> PEX
429 return PEX(self.exe)
430
431 def assert_success(
432 self,
433 expected_output_re=None, # type: Optional[str]
434 expected_error_re=None, # type: Optional[str]
435 re_flags=0, # type: int
436 ):
437 # type: (...) -> None
438 assert self.return_code == 0, to_unicode(
439 "integration test failed: return_code={return_code}, output={output}, error={error}"
440 ).format(return_code=self.return_code, output=self.output, error=self.error)
441 self.assert_output(expected_output_re, expected_error_re, re_flags)
442
443 def assert_failure(
444 self,
445 expected_error_re=None, # type: Optional[str]
446 expected_output_re=None, # type: Optional[str]
447 re_flags=0, # type: int
448 ):
449 # type: (...) -> None
450 assert self.return_code != 0
451 self.assert_output(expected_output_re, expected_error_re, re_flags)
452
453 def assert_output(
454 self,
455 expected_output_re=None, # type: Optional[str]
456 expected_error_re=None, # type: Optional[str]
457 re_flags=0, # type: int
458 ):
459 if expected_output_re:
460 assert re.match(expected_output_re, self.output, flags=re_flags), to_unicode(

Callers 5

execute_pexFunction · 0.90
execute_pexFunction · 0.90
run_pex_toolsFunction · 0.90
run_pex3Function · 0.90
run_pex_commandFunction · 0.85

Calls

no outgoing calls

Tested by 3

execute_pexFunction · 0.72
execute_pexFunction · 0.72
run_pex_toolsFunction · 0.72