Skip to content

Commit e870ac0

Browse files
committed
Add some tests for req_output
1 parent 072a2cb commit e870ac0

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

batchspawner/tests/test_spawners.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,41 @@ def test_slurm(db, io_loop):
480480
re.compile(r"^#SBATCH \s+ some_option_asdf", re.X | re.M),
481481
re.compile(r"^#SBATCH \s+ --reservation=RES123", re.X | re.M),
482482
re.compile(r"^#SBATCH \s+ --gres=GRES123", re.X | re.M),
483+
re.compile(
484+
r"^\#SBATCH \s+ --output= .+ /jupyterhub_slurmspawner_%j.log", re.X | re.M
485+
),
486+
]
487+
from .. import SlurmSpawner
488+
489+
run_spawner_script(
490+
db,
491+
io_loop,
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+
def test_slurm_req_output(db, io_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+
),
483518
]
484519
from .. import SlurmSpawner
485520

0 commit comments

Comments
 (0)