Exemple #1
0
def test_env_singleton(cwas_env_path: Path):
    env1 = Env()
    env2 = Env()
    assert env1 is env2

    new_env_path = Path(str(cwas_env_path) + "_new")
    env3 = Env(new_env_path)
    env4 = Env()
    assert env1 is env3
    assert env1 is env4
    assert env1.get_path() is new_env_path

    env1.set_path(cwas_env_path)
Exemple #2
0
 def __init__(self, args: argparse.Namespace):
     self.env = Env()
     arg_dict = vars(args)
     for arg in arg_dict:
         arg_val = arg_dict.get(arg)
         if isinstance(arg_val, Path):
             arg_val = arg_val.resolve()
         setattr(self, arg, arg_val)
Exemple #3
0
def teardown(cwas_workspace):
    yield
    env = Env()
    env.reset()
    env.remove_file()
    for f in cwas_workspace.glob("*"):
        f.unlink()
    cwas_workspace.rmdir()
Exemple #4
0
def set_env(cwas_workspace, annotation_dir):
    env = Env()
    env.set_env("CWAS_WORKSPACE", cwas_workspace)
    env.set_env("VEP", "VEP")
    env.set_env("ANNOTATION_DATA", annotation_dir)
    env.set_env("ANNOTATION_BW_KEY", annotation_dir / "bw_key.yaml")
    env.set_env("MERGED_BED", cwas_workspace / "merged.bed.gz")
    env.set_env("MERGED_BED_INDEX", cwas_workspace / "merged.bed.gz.tbi")
    env.save()
Exemple #5
0
def teardown(cwas_workspace: Path, vep_mock: Path):
    yield
    vep_mock.unlink()
    env = Env()
    env.reset()
    env.remove_file()
    for f in cwas_workspace.glob("*"):
        f.unlink()
    cwas_workspace.rmdir()
Exemple #6
0
def cwas_env_inst(cwas_env_path):
    env_inst = Env(cwas_env_path)
    yield
    env_inst.remove_file()
Exemple #7
0
def env_inst():
    return Env()
Exemple #8
0
def reset_env():
    env = Env()
    env.reset()
    env.remove_file()
Exemple #9
0
def set_env(cwas_workspace: Path, annotation_dir: Path):
    env = Env()
    env.set_env("CWAS_WORKSPACE", cwas_workspace)
    env.set_env("ANNOTATION_DATA", annotation_dir)
    env.set_env("ANNOTATION_BED_KEY", cwas_workspace / "bed_key.yaml")
    env.save()
Exemple #10
0
def test_run_without_configuration():
    inst = PreparationMock.get_instance()
    Env().reset()
    with pytest.raises(RuntimeError):
        inst.run()
Exemple #11
0
def set_env(cwas_workspace: Path):
    env = Env()
    env.set_env("CWAS_WORKSPACE", cwas_workspace)
    env.save()
Exemple #12
0
def _make_env_empty():
    env = Env()
    env.reset()
    env.save()