Skip to content

Commit

Permalink
allow user to set temp dir with APPTAINER_TMPDIR
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Walker committed Nov 21, 2023
1 parent 9166d64 commit 0ed6bae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_tmpdir.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test that all temporary directories respect the --tmpdir-prefix and --tmp-outdir-prefix options."""
import re
import shutil
import os
import subprocess
import sys
from pathlib import Path
Expand Down Expand Up @@ -169,10 +170,11 @@ def test_dockerfile_tmpdir_prefix(tmp_path: Path, monkeypatch: pytest.MonkeyPatc
@needs_singularity
def test_dockerfile_singularity_build(monkeypatch: pytest.MonkeyPatch) -> None:
"""Test that SingularityCommandLineJob.get_image builds a Dockerfile with Singularity."""
# cannot use /tmp
build_path = os.environ["APPTAINER_TMPDIR"]
if build_path is not None:
tmp_path = Path(build_path)
# some HPC not allowed to execute on /tmp so allow user to define temp path with APPTAINER_TMPDIR
# FATAL: Unable to create build: 'noexec' mount option set on /tmp, temporary root filesystem
# Will use current working directory instead
tmp_path = Path.cwd()
monkeypatch.setattr(target=subprocess, name="check_call", value=lambda *args, **kwargs: True)
(tmp_path / "out").mkdir(exist_ok=True)
tmp_outdir_prefix = tmp_path / "out" / "1"
Expand Down

0 comments on commit 0ed6bae

Please sign in to comment.