Skip to content

Commit

Permalink
Add some tests for req_output
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 authored and consideRatio committed Mar 16, 2024
1 parent e0253b4 commit 35c6034
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions batchspawner/tests/test_spawners.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,40 @@ async def test_slurm(db, event_loop):
re.compile(r"^\#SBATCH \s+ some_option_asdf", re.X | re.M),
re.compile(r"^\#SBATCH \s+ --reservation=RES123", re.X | re.M),
re.compile(r"^\#SBATCH \s+ --gres=GRES123", re.X | re.M),
re.compile(
r"^\#SBATCH \s+ --output= .+ /jupyterhub_slurmspawner_%j.log", re.X | re.M
),
]
from .. import SlurmSpawner

await run_spawner_script(
db,
SlurmSpawner,
normal_slurm_script,
batch_script_re_list=batch_script_re_list,
spawner_kwargs=spawner_kwargs,
)


@pytest.mark.parametrize(
"req_output,expected_file_pattern",
[
("/dev/null", "/dev/null"),
("slurm-%j.out", "{homedir}/slurm-%j.out"),
],
)
async def test_slurm_req_output(db, event_loop, req_output, expected_file_pattern):
homedir = "/users/jhub_users"
spawner_kwargs = {
"req_output": req_output,
"req_homedir": homedir,
}

batch_script_re_list = [
re.compile(
r"^\#SBATCH \s+ --output=" + expected_file_pattern.format(homedir=homedir),
re.X | re.M,
),
]
from .. import SlurmSpawner

Expand Down

0 comments on commit 35c6034

Please sign in to comment.