Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on invalid config data #855

Merged
merged 4 commits into from
Nov 6, 2022
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
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Changed
- Rather than searching upwards until the root, ``load_config`` will only load configuration files in the specified directory, which is assumed to be a project directory, as well as the user's home directory (#711).
- Changed the ``root`` parameter to ``path`` in the ``signac.get_project`` and ``signac.init_project`` functions and corresponding ``Project`` methods (#757, #758).
- The prefix argument to ``$ signac view`` is now optional and can be provided with ``-p/--prefix`` (#653, #774).
- Detection of an invalid config will raise an error rather than a debug log (#855).

Removed
+++++++
Expand Down
12 changes: 6 additions & 6 deletions signac/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def _read_config_file(filename):
except (OSError, ConfigObjError) as error:
raise ConfigError(f"Failed to read configuration file '{filename}':\n{error}")
verification = config.verify()
# config.verify() returns True if everything succeeded, but if the
# validation failed it will return a dictionary of invalid results. We
# cannot simply check for a truthy value here since a non-empty dict will
# evaluate to True.
if verification is not True:
# TODO: In the future this should raise an error, not just a
# debug-level logging notice.
logger.debug(
"Config file '{}' may contain invalid values.".format(
os.path.abspath(filename)
)
raise ConfigError(
f"Config file '{os.path.abspath(filename)}' may contain invalid values."
)
return config

Expand Down