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

Exit Exceptions Stopping invoke tests Execution #195

Open
DistantVoyager opened this issue Nov 4, 2024 · 1 comment
Open

Exit Exceptions Stopping invoke tests Execution #195

DistantVoyager opened this issue Nov 4, 2024 · 1 comment

Comments

@DistantVoyager
Copy link

Environment

  • Python version: 3.11
  • cookiecutter-nautobot-app template version: 2.4.0

Observed Behavior

invoke tests seems to be exiting immediately after the ruff test, even though the ruff test is passing.

(nautobot-data-validation-engine-py3.10) steven:~/nautobot-app-data-validation-engine$ invoke tests
Starting Docker Containers...
Starting Nautobot in detached mode...
Running docker compose command "up --detach"
 Container nautobot-data-validation-engine-redis-1  Running
 Container nautobot-data-validation-engine-docs-1  Running
 Container nautobot-data-validation-engine-db-1  Running
 Container nautobot-data-validation-engine-nautobot-1  Running
 Container nautobot-data-validation-engine-beat-1  Running
 Container nautobot-data-validation-engine-worker-1  Running
 Container nautobot-data-validation-engine-db-1  Waiting
 Container nautobot-data-validation-engine-db-1  Healthy
 Container nautobot-data-validation-engine-nautobot-1  Waiting
 Container nautobot-data-validation-engine-nautobot-1  Waiting
 Container nautobot-data-validation-engine-nautobot-1  Healthy
 Container nautobot-data-validation-engine-nautobot-1  Healthy
Running ruff...
Running docker compose command "ps --services --filter status=running"
Running docker compose command "exec nautobot ruff format --check ."
35 files already formatted
Running docker compose command "ps --services --filter status=running"
Running docker compose command "exec nautobot ruff check --output-format concise ."
All checks passed!
(nautobot-data-validation-engine-py3.10) steven:~/nautobot-app-data-validation-engine$

Expected Behavior

All tests should be run. This issue appears to stem from the cookiecutter app temple v2.4.0 which introduces exit codes to the ruff() test.

The ruff function has the line raise Exit(code=exit_code), which raises an Exit exception with the exit_code after ruff runs. This stops the invoke tests execution immediately, regardless of whether ruff succeeds or fails.

invoke tests calls ruff(context), which then raises Exit upon completion, causing the script to exit immediately after ruff runs, without moving on to the subsequent steps.

Steps to Reproduce

  1. Run invoke tests for an app that has been rebaked using cookiecutter app template v2.4.0
@DistantVoyager DistantVoyager changed the title ruff Exit Exception Stopping invoke tests Execution Exit Exceptions Stopping invoke tests Execution Nov 4, 2024
@DistantVoyager
Copy link
Author

This is also happening in the same way with the pylint test.

When skipping the ruff test to allow invoke tests to continue, execution also stops even on a successful pylint run presumably due to the same exit exception code also in the pylint() method.

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

No branches or pull requests

1 participant