Skip to content

Commit

Permalink
Fixed #464
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Dec 7, 2023
1 parent 2b3cc39 commit dd69b8e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 0 additions & 1 deletion peppy/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from contextlib import suppress
from logging import getLogger
from typing import Iterable, List, Tuple, Union, Literal, NoReturn
import yacman

import numpy as np
import pandas as pd
Expand Down
5 changes: 3 additions & 2 deletions peppy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Dict
from urllib.request import urlopen

import yacman
import yaml
from ubiquerg import expandpath, is_url

Expand Down Expand Up @@ -123,11 +124,11 @@ def load_yaml(filepath):
)
else:
data = response.read().decode("utf-8")
return yaml.safe_load(data)
return yacman.YAMLConfigManager(yamldata=data).exp
else:
with open(os.path.abspath(filepath), "r") as f:
data = yaml.safe_load(f)
return data
return yacman.YAMLConfigManager(data).exp


def is_cfg_or_anno(file_path, formats=None):
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pandas>=0.24.2
pyyaml
rich>=10.3.0
ubiquerg>=0.6.2
yacman>=0.9.0
yacman>=0.9.2
13 changes: 13 additions & 0 deletions tests/test_Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ def test_instantiaion(self, example_pep_cfg_path, defer):
p = Project(cfg=example_pep_cfg_path, defer_samples_creation=defer)
assert isinstance(p, Project)

@pytest.mark.parametrize("defer", [False, True])
@pytest.mark.parametrize("example_pep_cfg_path", ["amendments1"], indirect=True)
def test_expand_path(self, example_pep_cfg_path, defer):
"""
Verify output_path is expanded
"""
p = Project(
cfg=example_pep_cfg_path,
amendments="newLib",
defer_samples_creation=defer,
)
assert not p.config["output_dir"].startswith("$")

@pytest.mark.parametrize(
"config_path",
[
Expand Down

0 comments on commit dd69b8e

Please sign in to comment.