Skip to content

Commit 6a963a8

Browse files
fix(bump.py): use sys.stdin.isatty()
For some reason, `pytest-mock` does not affect `os.isatty` when `sys.stdin` is mocked to use `StringIO` (i.e. a file-like object). Checking `sys.stdin.isatty()` works and is equivalent to checking `os.isatty(0)` (`stdin` is file descriptor `0`).
1 parent d1a2919 commit 6a963a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

commitizen/commands/check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _valid_command_argument(self):
4040
arg is not None
4141
for arg in (self.commit_msg_file, self.commit_msg, self.rev_range)
4242
)
43-
if num_exclusive_args_provided == 0 and not os.isatty(0):
43+
if num_exclusive_args_provided == 0 and not sys.stdin.isatty():
4444
self.commit_msg: Optional[str] = sys.stdin.read()
4545
elif num_exclusive_args_provided != 1:
4646
raise InvalidCommandArgumentError(

0 commit comments

Comments
 (0)