Skip to content

Commit

Permalink
Fix arguments ignored if no config file found (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
awoimbee authored Feb 5, 2024
1 parent 3651546 commit 84fa20f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
---------

0.1.3 (2024-02-02)
******************

Fix config args not taken into account if a config file is not found

0.1.2 (2024-01-24)
******************

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "ansys-simai-core"
version = "0.1.2"
version = "0.1.3"
description = "A python wrapper for Ansys SimAI"
authors = [
{name = "ANSYS, Inc.", email = "pyansys.core@ansys.com"},
Expand Down Expand Up @@ -170,4 +170,3 @@ source = ["ansys.simai.core"]

[tool.coverage.report]
show_missing = true

2 changes: 1 addition & 1 deletion src/ansys/simai/core/utils/config_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get_config(
config_path = path or _scan_defaults_config_paths()
if config_path is None:
if ignore_missing:
return {}
return kwargs
raise ConfigurationNotFoundError
config_path = Path(config_path).expanduser()
if not os.path.isfile(config_path):
Expand Down
9 changes: 9 additions & 0 deletions tests/test_utils_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,12 @@ def test_get_config_invalid_profile(tmpdir):
f.flush()
with pytest.raises(err.InvalidConfigurationError):
get_config(profile="kaboom", path=path_config)


def test_get_config_ignore_missing(mocker):
mocker.patch(
"ansys.simai.core.utils.config_file._scan_defaults_config_paths",
return_value=None,
)
config = get_config(ignore_missing=True, organization="kangarooooo")
assert config == {"organization": "kangarooooo"}

0 comments on commit 84fa20f

Please sign in to comment.