Skip to content

Fix export -v crashing when the lock file is missing - #384

Open
guru-bharadwaj20 wants to merge 1 commit into
python-poetry:mainfrom
guru-bharadwaj20:fix-export-verbose-lock
Open

guru-bharadwaj20 wants to merge 1 commit into
python-poetry:mainfrom
guru-bharadwaj20:fix-export-verbose-lock

Conversation

@guru-bharadwaj20

Copy link
Copy Markdown

Resolves: #110

  • Added tests for changed code.
  • Updated documentation for changed code.

When there is no lock file, poetry export runs lock first and passes the current verbosity along. Those options were collected as ("-v", None) tuples and then given to " ".join(), so poetry export -v, -vv or -vvv without a lock file failed with TypeError: sequence item 0: expected str instance, tuple found. With no verbosity flag the list is empty, which is why a plain poetry export worked.

The list now holds plain strings, and I dropped the type: ignore that was hiding the mypy error.

The new parametrized test runs the command at each of the three verbosity levels with no lock file. It fails with the TypeError on main and passes with this change.

What I ran:

  • pytest: 188 passed
  • mypy: no issues
  • pre-commit run --files on the two changed files: passed
  • In a scratch project with no poetry.lock, poetry export -v raised the TypeError before the change. With it, the lock file is created and the export finishes.

The verbosity options passed to the implicit lock call were tuples, so joining them raised a TypeError.
Copilot AI balanced review requested due to automatic review settings November 28, 2026 17:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@sonarqubecloud

Copy link
Copy Markdown

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.

verbose options passed as tuple rather than str

2 participants