Skip to content

fix(cli): apply warning filter prior to execute_routing and add test coverage - #204

Open
vaibhavsrv wants to merge 1 commit into
52North:mainfrom
vaibhavsrv:fix-cli-warning-filter-order
Open

vaibhavsrv wants to merge 1 commit into
52North:mainfrom
vaibhavsrv:fix-cli-warning-filter-order

Conversation

@vaibhavsrv

@vaibhavsrv vaibhavsrv commented Sep 6, 2026 •

Copy link
Copy Markdown

Related Issue / Discussion:

Fixes Issue #205

Changes:

  • Modified: cli.py — Refactored CLI logic into a testable main(args_list=None) function and moved warnings.filterwarnings() prior to execute_routing().
  • New: tests/test_cli.py — Added unit tests for CLI argument parsing, debug boolean handling, and call order assertions.

Further Details:

Summary:

  • Motivation & Context: Currently, warnings.filterwarnings(args.filter_warnings) in cli.py is invoked after execute_routing() has already run. Consequently, any warnings issued during dataset loading or optimization bypass the specified filter setting.
  • Before: Warning filter configuration occurred on the last line of cli.py after route execution finished.
  • After: Warning filter configuration is executed immediately after argument parsing, prior to logging initialization and route optimization.

Dependencies:

No new external dependencies required.

PR Checklist:

In the context of this PR, I:

  • have filled the 52North Contributor License Agreement and am waiting for feedback
  • provide unit tests embedded in the WRT test framework (WeatherRoutingTool/tests) that allow the simple testing of the new/modified functionalities. All (previous and new) unit tests execute without new error messages.
  • ensure that the code formatter runs without errors/warnings
  • ensure that my changes follow the WRT’s guidelines for contributing at the time of the contribution

This branch has not been deployed

No deployments
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.

1 participant