Skip to content

Commit

Permalink
Added a test for milex-initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreAdam committed Jul 11, 2024
1 parent c1c8058 commit 6161e2e
Showing 1 changed file with 26 additions and 0 deletions.
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_name="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()

Check failure on line 26 in tests/integration/test_milex_initialize.py

View workflow job for this annotation

GitHub Actions / build (3.10, ubuntu-latest)

test_main AttributeError: 'Namespace' object has no attribute 'bundle'

Check failure on line 26 in tests/integration/test_milex_initialize.py

View workflow job for this annotation

GitHub Actions / build (3.10, macOS-latest)

test_main AttributeError: 'Namespace' object has no attribute 'bundle'

Check failure on line 26 in tests/integration/test_milex_initialize.py

View workflow job for this annotation

GitHub Actions / build (3.10, ubuntu-latest)

test_main AttributeError: 'Namespace' object has no attribute 'bundle'

Check failure on line 26 in tests/integration/test_milex_initialize.py

View workflow job for this annotation

GitHub Actions / build (3.10, macOS-latest)

test_main AttributeError: 'Namespace' object has no attribute 'bundle'

0 comments on commit 6161e2e

Please sign in to comment.