Skip to content
Draft
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
that PEtab condition changes are applied before its assignments.
Previously, their order was undefined
(by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/562)
* `petablint` no longer fails for PEtab v2 problems with only warnings,
consistent with PEtab v1. Warnings are still reported
(by @dweindl in https://github.com/PEtab-dev/libpetab-python/pull/569)

**Features**
* `petab1to2` and `petab_files_1to2` can skip validation via `validate=False`
Expand Down
6 changes: 3 additions & 3 deletions petab/petablint.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def main():

try:
validation_issues = lint_problem(args.yaml_file_name)
if validation_issues:
# Handle petab.v2.lint.ValidationTask issues
validation_issues.log(logger=logger)
# Handle petab.v2.lint.ValidationTask issues
validation_issues.log(logger=logger)
if validation_issues.has_errors():
sys.exit(1)
logger.info("PEtab format check completed successfully.")
sys.exit(0)
Expand Down
29 changes: 29 additions & 0 deletions tests/v2/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,35 @@ def test_petablint_v2(tmpdir):
check=True,
)

# warnings are reported, but don't make petablint fail
problem.add_condition("unused_condition", B=1)
problem.condition_tables[0].rel_path = "conditions.tsv"
problem.config.condition_files = ["conditions.tsv"]
issues = problem.validate()
assert issues
assert not issues.has_errors()
problem.to_files(Path(tmpdir))
result = subprocess.run( # noqa S607
["petablint", str(Path(tmpdir, "problem.yaml"))], # noqa S607
capture_output=True,
text=True,
)
assert result.returncode == 0
assert "CheckUnusedConditions" in result.stdout + result.stderr

# errors make petablint fail
problem.add_measurement(
"obs_undefined", time=10, measurement=2.5, experiment_id=""
)
assert problem.validate().has_errors()
problem.to_files(Path(tmpdir))
result = subprocess.run( # noqa S607
["petablint", str(Path(tmpdir, "problem.yaml"))], # noqa S607
capture_output=True,
text=True,
)
assert result.returncode == 1


def test_problem_id(tmpdir):
"""Test that the problem ID works as expected."""
Expand Down
Loading