-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
odb.git: Send captured-but-discarded output to DEVNULL
#99
Conversation
The CI error is unrelated to these changes, I believe: it's the GPG changes:
|
Oh well. I've opened #104 which should at least fix the |
@mystor Not sure if there's a way to re-run the GitHub actions, but I believe this PR is good to go otherwise. |
This PR is still good to go and had no conflicts, but has been rebased as well. |
This avoids buffering/consuming output that's always discarded.
The output was previously suppressed/discarded, but that mistake was made more visible by the explicit "stdout=DEVNULL" argument.
stdin: Optional[bytes] = None, | ||
stdout: _FILE = PIPE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I guess the added consistency is because now input-related parameters come before all output-related ones.
gitrevise/odb.py
Outdated
@@ -43,6 +45,7 @@ def __init__(self, stderr: str) -> None: | |||
|
|||
|
|||
T = TypeVar("T") # pylint: disable=invalid-name | |||
_FILE = Union[None, int, IO[Any]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we call this File
to be consisten with the typing module?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context, this definition is directly inlined from subprocess.pyi
as the type of that Popen
argument: https://github.com/python/typeshed/blob/98afaa4c76d4279846f278eb5be8b99c391e6a99/stdlib/subprocess.pyi#L24
It's inlined here because it's not an exported type name, so I wasn't certain it would be importable in all supported versions. Alternatively it could also be done as:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from subprocess import _FILE
My only very minor concern with calling it File
is increasing drift from Popen
's type.
Preference between:
- Leave it as is
- Import it
- Change name to
File
?
LGTM |
Ok, then I think leaving it is fine (maybe add a note in the commit message). Importing would be ideal if possible (perhaps even with an alias).
I don't know much about Python, I guess it's just about the leading underscore (which by convention means "private")? |
The leading underscore is the conventional hint, but the practical hiccup was mainly that But I think you're right. Since CI runs on all versions, importing with a |
I believe the CI failure is again unrelated. See #113 for (potential) fix to the race conditions in the current editor-testing code. |
If it’s possible to rerun those tests, please do! |
Thanks for the fixes! |
This avoids buffering captured output that's always discarded. The parameter change from
nocapture
tostdout
also makes it possible to direct that output to some other file/pipe.