Skip to content

fix(validate): exit with code 1 when overwrite is declined - #386

Merged
marcosmc merged 3 commits into
dynawo:masterfrom
snowyukitty:fix/initialize-env-decline-exit-code
Aug 24, 2026
Merged

marcosmc merged 3 commits into
dynawo:masterfrom
snowyukitty:fix/initialize-env-decline-exit-code

Conversation

@snowyukitty

Copy link
Copy Markdown
Contributor

Problem

When a user declines to overwrite an existing output/results directory in __initialize_working_environment(), Validation called sys.exit() with no arguments. This resulted in an exit code of 0, incorrectly indicating success to caller scripts or CI workflows (#381).

Solution

  • In src/dycov/validate/validation.py, change sys.exit() to sys.exit(1) when the output directory check prompts the exit warning.
  • In tests/dycov/validate/test_validation.py:test_validation_exits_on_existing_output_dir, assert that exc_info.value.code == 1.

Fixes #381

When a user declines to overwrite an existing output directory in __initialize_working_environment(), Validation previously called sys.exit() with no arguments, yielding exit code 0. Call sys.exit(1) so the abort signals a failure to callers and CI scripts.

Fixes dynawo#381
@marcosmc

Copy link
Copy Markdown
Collaborator

Thanks for the contribution — the change is correct.

Completed on top of your branch: the same bare sys.exit() was in gfm/generator.py:103 (identical decline-to-overwrite path) and core/initialization.py:351 (aborted precompile), both now sys.exit(1), plus a test for each. No bare sys.exit() left in src/dycov/. 777 passed, ruff clean.

@marcosmc
marcosmc merged commit 6c00823 into dynawo:master Aug 24, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__initialize_working_environment: exits with code 0 when the user declines to overwrite Results

2 participants