File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 77import subprocess
88import sys
99import tempfile
10- from asyncio import DefaultEventLoopPolicy , get_event_loop_policy , set_event_loop_policy
10+ from asyncio import get_event_loop_policy , set_event_loop_policy
11+ from asyncio .unix_events import _UnixDefaultEventLoopPolicy
1112from io import IOBase
1213
1314import questionary
3031from commitizen .git import smart_open
3132
3233
33- class CZEventLoopPolicy (DefaultEventLoopPolicy ):
34+ class CZEventLoopPolicy (_UnixDefaultEventLoopPolicy ):
3435 def get_event_loop (self ):
3536 self .set_event_loop (self ._loop_factory (selectors .SelectSelector ()))
3637 return self ._local ._loop
@@ -44,7 +45,7 @@ def __init__(self, stdx: IOBase):
4445 fd = os .open ("/dev/tty" , os .O_RDWR | os .O_NOCTTY )
4546 tty = open (fd , "wb+" , buffering = 0 )
4647 else :
47- tty = open ("/dev/tty" , "w " )
48+ tty = open ("/dev/tty" , "wb " )
4849 else :
4950 fd = os .open ("/dev/tty" , os .O_RDWR | os .O_NOCTTY )
5051 if self ._fileno == 0 :
Original file line number Diff line number Diff line change @@ -575,7 +575,7 @@ def test_WrapStdx(mocker):
575575 wrap_stout .write ("data" )
576576
577577 if sys .platform == "linux" :
578- writer_mock .assert_called_once_with ("/dev/tty" , "w " )
578+ writer_mock .assert_called_once_with ("/dev/tty" , "wb " )
579579 else :
580580 pass
581581 writer_mock ().write .assert_called_once_with ("data" )
@@ -589,7 +589,7 @@ def test_WrapStdx(mocker):
589589 wrap_sterr .write ("data" )
590590
591591 if sys .platform == "linux" :
592- writer_mock .assert_called_once_with ("/dev/tty" , "w " )
592+ writer_mock .assert_called_once_with ("/dev/tty" , "wb " )
593593 else :
594594 pass
595595 writer_mock ().write .assert_called_once_with ("data" )
You can’t perform that action at this time.
0 commit comments