コード例 #1
0
def _testnet_cleanup(pytest_root_tmp: Path) -> None:
    """Perform testnet cleanup at the end of session."""
    if cluster_nodes.get_cluster_type(
    ).type != cluster_nodes.ClusterType.TESTNET_NOPOOLS:
        return

    # there's only one cluster instance for testnets, so we don't need to use cluster manager
    cluster_obj = cluster_nodes.get_cluster_type().get_cluster_obj()

    destdir = pytest_root_tmp.parent / f"cleanup-{pytest_root_tmp.stem}-{helpers.get_rand_str(8)}"
    destdir.mkdir(parents=True, exist_ok=True)

    with helpers.change_cwd(dir_path=destdir):
        testnet_cleanup.cleanup(cluster_obj=cluster_obj,
                                location=pytest_root_tmp)
コード例 #2
0
def temp_dir(create_temp_dir: Path):
    """Change to a temporary dir."""
    with helpers.change_cwd(create_temp_dir):
        yield create_temp_dir
コード例 #3
0
def cd_testfile_temp_dir(
        testfile_temp_dir: Path) -> Generator[Path, None, None]:
    """Change to a temporary dir specific to a test file."""
    with helpers.change_cwd(testfile_temp_dir):
        yield testfile_temp_dir