Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packs/core/io.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import pandas as pd

import h5py
Expand Down Expand Up @@ -87,6 +89,10 @@ def read_config_file(file_path : str) -> dict:
# setup config parser
config = configparser.ConfigParser()

if not os.path.exists(file_path):
raise FileNotFoundError(2, 'No such config file', file_path)


# read in arguments, require the required ones
config.read(file_path)
arg_dict = {}
Expand Down
23 changes: 23 additions & 0 deletions packs/tests/io_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import sys

import numpy as np
import pandas as pd

from pytest import mark
from pytest import raises
from pytest import warns

from packs.core.io import read_config_file


def test_missing_config(tmp_path, MULE_dir):
'''
Simple test ensuring that when config file path is wrong,
MULE spits out a `FileNotFoundError`
'''

config_path = f'{tmp_path}/false_config.conf'

with raises(FileNotFoundError):
read_config_file(config_path)