Example #1
0
def test_direc(tmp_path_factory):

    original = config["direc"]
    direc = tmp_path_factory.mktemp("testtmp")

    config["direc"] = str(direc)

    yield direc

    printdir(direc)
    # Clear all cached items created.
    clear_cache(direc=str(direc))

    # Set direc back to original.
    config["direc"] = original
Example #2
0
def setup_and_teardown_package(tmpdirec):
    # Set nice global defaults for testing purposes, to make runs faster
    # (can always be over-ridden per-test).
    original_zprime = global_params.ZPRIME_STEP_FACTOR

    # Set default global parameters for all tests
    global_params.ZPRIME_STEP_FACTOR = 1.2

    # Set default config parameters for all tests.
    config["direc"] = str(tmpdirec)
    config["regenerate"] = True
    config["write"] = False

    yield

    printdir(tmpdirec)

    clear_cache(direc=str(tmpdirec))
    global_params.ZPRIME_STEP_FACTOR = original_zprime
Example #3
0
def setup_and_teardown_package(tmpdirec, request):
    # Set nice global defaults for testing purposes, to make runs faster
    # (can always be over-ridden per-test).
    original_zprime = global_params.ZPRIME_STEP_FACTOR

    # Set default global parameters for all tests
    global_params.ZPRIME_STEP_FACTOR = 1.2

    # Set default config parameters for all tests.
    config["direc"] = str(tmpdirec)
    config["regenerate"] = True
    config["write"] = False

    log_level = request.config.getoption("--log-level-21") or logging.INFO
    logging.getLogger("py21cmfast").setLevel(log_level)

    yield

    printdir(tmpdirec)

    clear_cache(direc=str(tmpdirec))
    global_params.ZPRIME_STEP_FACTOR = original_zprime