Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e48561c

Browse files
t20100consideRatio
authored andcommittedMar 16, 2024·
Add some tests for req_output
1 parent e0253b4 commit e48561c

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
 

‎batchspawner/tests/test_spawners.py

+35
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,41 @@ 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+
run_spawner_script(
491+
db,
492+
event_loop,
493+
SlurmSpawner,
494+
normal_slurm_script,
495+
batch_script_re_list=batch_script_re_list,
496+
spawner_kwargs=spawner_kwargs,
497+
)
498+
499+
500+
@pytest.mark.parametrize(
501+
"req_output,expected_file_pattern",
502+
[
503+
("/dev/null", "/dev/null"),
504+
("slurm-%j.out", "{homedir}/slurm-%j.out"),
505+
],
506+
)
507+
def test_slurm_req_output(db, io_loop, req_output, expected_file_pattern):
508+
homedir = "/users/jhub_users"
509+
spawner_kwargs = {
510+
"req_output": req_output,
511+
"req_homedir": homedir,
512+
}
513+
514+
batch_script_re_list = [
515+
re.compile(
516+
r"^\#SBATCH \s+ --output=" + expected_file_pattern.format(homedir=homedir),
517+
re.X | re.M,
518+
),
484519
]
485520
from .. import SlurmSpawner
486521

0 commit comments

Comments
 (0)
Please sign in to comment.