Ejemplo n.º 1
0
    return str(Path(filepath).resolve())


needs_docker = pytest.mark.skipif(
    not bool(distutils.spawn.find_executable("docker")),
    reason="Requires the docker executable on the system path.",
)

needs_singularity = pytest.mark.skipif(
    not bool(distutils.spawn.find_executable("singularity")),
    reason="Requires the singularity executable on the system path.",
)

needs_singularity_2_6 = pytest.mark.skipif(
    not bool(
        distutils.spawn.find_executable("singularity") and is_version_2_6()),
    reason=
    "Requires that version 2.6.x of singularity executable version is on the system path.",
)

needs_singularity_3_or_newer = pytest.mark.skipif(
    (not bool(distutils.spawn.find_executable("singularity")))
    or (not is_version_3_or_newer()),
    reason=
    "Requires that version 3.x of singularity executable version is on the system path.",
)

windows_needs_docker = pytest.mark.skipif(
    onWindows() and not bool(distutils.spawn.find_executable("docker")),
    reason="Running this test on MS Windows requires the docker executable "
    "on the system path.",
Ejemplo n.º 2
0
    if not filepath or not os.path.isfile(filepath):
        filepath = os.path.join(os.path.dirname(__file__), os.pardir, filename)
    return Text(Path(filepath).resolve())


needs_docker = pytest.mark.skipif(
    not bool(distutils.spawn.find_executable('docker')),
    reason="Requires the docker executable on the "
    "system path.")

needs_singularity = pytest.mark.skipif(
    not bool(distutils.spawn.find_executable('singularity')),
    reason="Requires the singularity executable on the system path.")

needs_singularity_2_6 = pytest.mark.skipif(
    not (distutils.spawn.find_executable('singularity') and is_version_2_6()),
    reason=
    "Requires that version 2.6.x of singularity executable version is on the system path."
)

needs_singularity_3_or_newer = pytest.mark.skipif(
    not (distutils.spawn.find_executable('singularity')
         and is_version_3_or_newer),
    reason=
    "Requires that version 2.6.x of singularity executable version is on the system path."
)

windows_needs_docker = pytest.mark.skipif(
    onWindows() and not bool(distutils.spawn.find_executable('docker')),
    reason="Running this test on MS Windows requires the docker executable "
    "on the system path.")
Ejemplo n.º 3
0
        filepath = os.path.join(os.path.dirname(__file__), os.pardir, filename)
    return str(Path(filepath).resolve())


needs_docker = pytest.mark.skipif(
    not bool(shutil.which("docker")),
    reason="Requires the docker executable on the system path.",
)

needs_singularity = pytest.mark.skipif(
    not bool(shutil.which("singularity")),
    reason="Requires the singularity executable on the system path.",
)

needs_singularity_2_6 = pytest.mark.skipif(
    not bool(shutil.which("singularity") and is_version_2_6()),
    reason="Requires that version 2.6.x of singularity executable version is on the system path.",
)

needs_singularity_3_or_newer = pytest.mark.skipif(
    (not bool(shutil.which("singularity"))) or (not is_version_3_or_newer()),
    reason="Requires that version 3.x of singularity executable version is on the system path.",
)

needs_podman = pytest.mark.skipif(
    not bool(shutil.which("podman")),
    reason="Requires the podman executable on the system path.",
)

_env_accepts_null: Optional[bool] = None
Ejemplo n.º 4
0
def test_version_checks() -> None:
    """Confirm logic in the various singularity version checks."""
    set_dummy_check_output("apptainer", "1.0.1")
    reset_singularity_version_cache()
    assert is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert is_version_3_or_newer()
    assert is_version_3_1_or_newer()
    assert is_version_3_4_or_newer()

    set_dummy_check_output("apptainer", "0.0.1")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert not is_version_3_or_newer()
    assert not is_version_3_1_or_newer()
    assert not is_version_3_4_or_newer()

    set_dummy_check_output("singularity", "0.0.1")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert not is_version_3_or_newer()
    assert not is_version_3_1_or_newer()
    assert not is_version_3_4_or_newer()

    set_dummy_check_output("singularity", "0.1")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert not is_version_3_or_newer()
    assert not is_version_3_1_or_newer()
    assert not is_version_3_4_or_newer()

    set_dummy_check_output("singularity", "2.6")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert is_version_2_6()
    assert not is_version_3_or_newer()
    assert not is_version_3_1_or_newer()
    assert not is_version_3_4_or_newer()

    set_dummy_check_output("singularity", "3.0")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert is_version_3_or_newer()
    assert not is_version_3_1_or_newer()
    assert not is_version_3_4_or_newer()

    set_dummy_check_output("singularity", "3.1")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert is_version_3_or_newer()
    assert is_version_3_1_or_newer()
    assert not is_version_3_4_or_newer()

    set_dummy_check_output("singularity", "3.4")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert is_version_3_or_newer()
    assert is_version_3_1_or_newer()
    assert is_version_3_4_or_newer()

    set_dummy_check_output("singularity", "3.6.3")
    reset_singularity_version_cache()
    assert not is_apptainer_1_or_newer()
    assert not is_version_2_6()
    assert is_version_3_or_newer()
    assert is_version_3_1_or_newer()
    assert is_version_3_4_or_newer()
    restore_check_output()