Fix running debuggers inside airflow tasks test#26806
Merged
ashb merged 1 commit intoapache:mainfrom Sep 30, 2022
Merged
Conversation
As part of 2.3.3 we added redaction to output from the tasks test
command, but unfortunately that broke using a debugger with this error:
```
File "/usr/lib/python3.10/pdb.py", line 262, in user_line
self.interaction(frame, None)
File "/home/ash/.virtualenvs/airflow/lib/python3.10/site-packages/pdb.py", line 231, in interaction
self._cmdloop()
File "/usr/lib/python3.10/pdb.py", line 322, in _cmdloop
self.cmdloop()
File "/usr/lib/python3.10/cmd.py", line 126, in cmdloop
line = input(self.prompt)
TypeError: 'NoneType' object cannot be interpreted as an integer
```
(ipdb has a similar but different error)
The "fix" is to assign a fileno attribute to the object. `input()` needs
this to write the prompt. It feels like a "bug" that it doesn't work
without it, but as this class is only used in `tasks test` this is a
safe change
jedcunningham
approved these changes
Sep 30, 2022
eladkal
approved these changes
Sep 30, 2022
dstandish
approved these changes
Sep 30, 2022
|
|
||
| def test_input_builtin(self, monkeypatch): | ||
| """ | ||
| Test that when redirect is inplace the `input()` builtin works. |
Contributor
There was a problem hiding this comment.
Suggested change
| Test that when redirect is inplace the `input()` builtin works. | |
| Test that when redirect is in place the `input()` builtin works. |
ephraimbuddy
pushed a commit
that referenced
this pull request
Oct 18, 2022
As part of 2.3.3 we added redaction to output from the tasks test
command, but unfortunately that broke using a debugger with this error:
```
File "/usr/lib/python3.10/pdb.py", line 262, in user_line
self.interaction(frame, None)
File "/home/ash/.virtualenvs/airflow/lib/python3.10/site-packages/pdb.py", line 231, in interaction
self._cmdloop()
File "/usr/lib/python3.10/pdb.py", line 322, in _cmdloop
self.cmdloop()
File "/usr/lib/python3.10/cmd.py", line 126, in cmdloop
line = input(self.prompt)
TypeError: 'NoneType' object cannot be interpreted as an integer
```
(ipdb has a similar but different error)
The "fix" is to assign a fileno attribute to the object. `input()` needs
this to write the prompt. It feels like a "bug" that it doesn't work
without it, but as this class is only used in `tasks test` this is a
safe change
(cherry picked from commit 029ebac)
37 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26802
As part of 2.3.3 we added redaction to output from the tasks test
command, but unfortunately that broke using a debugger with this error:
(ipdb has a similar but different error)
The "fix" is to assign a fileno attribute to the object.
input()needsthis to write the prompt. It feels like a "bug" that it doesn't work
without it, but as this class is only used in
tasks testthis is asafe change
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.