Skip to content

build_arg_list: Raise an exception if an invalid output file name is given - #3336

Merged
seisman merged 3 commits into
mainfrom
build_arg_list/check-output
Jul 19, 2024
Merged

build_arg_list: Raise an exception if an invalid output file name is given#3336
seisman merged 3 commits into
mainfrom
build_arg_list/check-output

Conversation

@seisman

@seismanseisman commented Jul 18, 2024

Copy link
Copy Markdown
Member

Description of proposed changes

When working on PR #3334, I realized that we didn't check if the outfile parameter passed to build_arg_list is valid or not. Some invalid values are "", ".", ".." or a string ending with / or \.

This PR enhances the build_arg_list function to check if the outfile argument is valid. We can't check all cases but at least we can raise an exception for a few common cases.

This PR will further simplify #3334.

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

@seisman
seisman marked this pull request as ready for review July 18, 2024 03:54
@seismanseisman added maintenance Boring but important stuff for the core devs needs review This PR has higher priority and needs review. run/benchmark Trigger the benchmark workflow in PRs labels Jul 18, 2024
@seismanseisman added this to the 0.13.0 milestone Jul 18, 2024

@weiji14weiji14 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok I think, just one suggestion to check the Windows-style folders ending with \\.

Comment threadpygmt/tests/test_helpers.py Outdated
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
@seisman

Copy link
Copy Markdown
MemberAuthor

/format

@seisman
seisman merged commit 419e931 into mainJul 19, 2024
@seisman
seisman deleted the build_arg_list/check-output branch July 19, 2024 01:30
@seismanseisman removed the needs review This PR has higher priority and needs review. label Oct 10, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenanceBoring but important stuff for the core devsrun/benchmarkTrigger the benchmark workflow in PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@seisman@weiji14