Skip to content

Avoid AttributeError when printing asynchronous Promises - #1095

Open
Hugohong258 wants to merge 1 commit into
pyinvoke:2.2from
Hugohong258:fix-promise-str-on-2-2
Open

Hugohong258 wants to merge 1 commit into
pyinvoke:2.2from
Hugohong258:fix-promise-str-on-2-2

Conversation

@Hugohong258

Copy link
Copy Markdown

Printing a Promise currently calls Result.__str__, which reads result attributes such as exited that the promise does not expose. Give Promise a command-only string representation that neither waits for completion nor invents an exit status. The two new regression tests fail on the base commit.

Fixes #996. This targets the 2.2 release line in accordance with the contribution guide's bugfix branching policy. Validation: 187 runner/result/promise tests pass, with 3 skips, on WSL Linux/Python 3.14.4 using a real PTY and disabled pytest capture. Real asynchronous-command smoke checks reproduce the original error and verify the fix on Windows/Python 3.12.3 and Linux/Python 3.14.4. Black 22.8 (79 columns), pycodestyle 2.8, pyflakes 2.4 and mypy 0.971 (Linux/Python 3.9 static target) pass. The pinned Flake8 4 launcher is incompatible with this host's importlib metadata API, so its core style/static components were run directly. The complete project and older-interpreter CI matrix were not run.

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