Пример #1
0
def assert_chroot(rule_runner: RuleRunner, expected_files,
                  expected_setup_kwargs, addr: Address) -> None:
    tgt = rule_runner.get_target(addr)
    chroot = rule_runner.request(
        SetupPyChroot,
        [SetupPyChrootRequest(ExportedTarget(tgt), py2=False)],
    )
    snapshot = rule_runner.request(Snapshot, [chroot.digest])
    assert sorted(expected_files) == sorted(snapshot.files)
    assert expected_setup_kwargs == chroot.setup_kwargs.kwargs
Пример #2
0
def assert_chroot_error(rule_runner: RuleRunner, addr: Address, exc_cls: Type[Exception]) -> None:
    tgt = rule_runner.get_target(addr)
    with pytest.raises(ExecutionError) as excinfo:
        rule_runner.request(
            SetupPyChroot,
            [SetupPyChrootRequest(ExportedTarget(tgt), py2=False)],
        )
    ex = excinfo.value
    assert len(ex.wrapped_exceptions) == 1
    assert type(ex.wrapped_exceptions[0]) == exc_cls