示例#1
0
def manual_output_check(capsys: CaptureFixture, test_name: str,
                        configfile_path: str) -> None:
    """
    Use for examples that have extensive error analysis (ex: the table produced by convergence testing).
    The error analysis output should be checked manually for correctness
    since there doesn't seem to be an easy way to parse it.

    Args:
        capsys: Pytest object used to get access to stdout and stderr
        test_name: The name of the current test being run, used for writing to console
        configfile_path: File path relative to OpenCMP/ for the config file
    """
    run_example(configfile_path)
    captured = capsys.readouterr()
    with capsys.disabled():
        print(test_name + ' output')
        print(captured.out)
示例#2
0
 def test_ge_master(self, aiosmtpd_version: version.Version,
                    capsys: pytest.CaptureFixture):
     """Ensure version is monotonically increasing"""
     reference = "master:aiosmtpd/__init__.py"
     cmd = f"git show {reference}".split()
     try:
         with capsys.disabled():
             master_smtp = subprocess.check_output(cmd).decode()  # nosec
     except subprocess.CalledProcessError:
         pytest.skip("Skipping due to git error")
         return
     for ln in master_smtp.splitlines():
         m = RE_DUNDERVER.match(ln)
         if m:
             break
     else:
         pytest.fail(f"Cannot find __version__ in {reference}!")
     master_ver = version.parse(m.group("ver"))
     assert aiosmtpd_version >= master_ver, "Version number cannot be < master's"