Skip to content

Commit 35c6034

Browse files
t20100consideRatio
authored andcommitted
Add some tests for req_output
1 parent e0253b4 commit 35c6034

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

batchspawner/tests/test_spawners.py

+34
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,40 @@ async def test_slurm(db, event_loop):
481481
re.compile(r"^\#SBATCH \s+ some_option_asdf", re.X | re.M),
482482
re.compile(r"^\#SBATCH \s+ --reservation=RES123", re.X | re.M),
483483
re.compile(r"^\#SBATCH \s+ --gres=GRES123", re.X | re.M),
484+
re.compile(
485+
r"^\#SBATCH \s+ --output= .+ /jupyterhub_slurmspawner_%j.log", re.X | re.M
486+
),
487+
]
488+
from .. import SlurmSpawner
489+
490+
await run_spawner_script(
491+
db,
492+
SlurmSpawner,
493+
normal_slurm_script,
494+
batch_script_re_list=batch_script_re_list,
495+
spawner_kwargs=spawner_kwargs,
496+
)
497+
498+
499+
@pytest.mark.parametrize(
500+
"req_output,expected_file_pattern",
501+
[
502+
("/dev/null", "/dev/null"),
503+
("slurm-%j.out", "{homedir}/slurm-%j.out"),
504+
],
505+
)
506+
async def test_slurm_req_output(db, event_loop, req_output, expected_file_pattern):
507+
homedir = "/users/jhub_users"
508+
spawner_kwargs = {
509+
"req_output": req_output,
510+
"req_homedir": homedir,
511+
}
512+
513+
batch_script_re_list = [
514+
re.compile(
515+
r"^\#SBATCH \s+ --output=" + expected_file_pattern.format(homedir=homedir),
516+
re.X | re.M,
517+
),
484518
]
485519
from .. import SlurmSpawner
486520

0 commit comments

Comments
 (0)