Skip to content

Commit

Permalink
Merge pull request #6 from Ciela-Institute/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AlexandreAdam authored Jul 11, 2024
2 parents 0e61add + 4bded8c commit 3ac74fe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/milex_scheduler/apps/milex_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def parse_args():
parser = argparse.ArgumentParser(description='Initialize a bundle of jobs to run with SLURM')
parser.add_argument('bundle', help='Name of the job bundle (JSON file containing multiple jobs/scripts to be scheduled).')
# fmt: on
args = parser.parse_known_args()
args = parser.parse_args()
return args


Expand Down
26 changes: 26 additions & 0 deletions tests/integration/test_milex_initialize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from argparse import Namespace
from unittest.mock import patch
from milex_scheduler.apps.milex_initialize import main
import pytest
import os


@pytest.fixture
def mock_parse_known_args():
with patch("argparse.ArgumentParser.parse_args") as mock_parse_known_args:
mock_parse_known_args.return_value = Namespace(bundle="bundle_name")
yield mock_parse_known_args


@pytest.fixture
def mock_load_config(tmp_path):
mock_config = {"local": {"path": tmp_path}}
os.makedirs(tmp_path / "jobs", exist_ok=True)
with patch(
"milex_scheduler.save_load_jobs.load_config", return_value=mock_config
) as mock_load_config:
yield mock_load_config


def test_main(mock_parse_known_args, mock_load_config):
main()

0 comments on commit 3ac74fe

Please sign in to comment.