File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -182,9 +182,9 @@ class _ReadlineWrapper(object):
182182 startup_hook = None
183183 config = ReadlineConfig ()
184184
185- def __init__ (self ):
186- self .f_in = os .dup (0 )
187- self .f_out = os .dup (1 )
185+ def __init__ (self , f_in = None , f_out = None ):
186+ self .f_in = f_in if f_in is not None else os .dup (0 )
187+ self .f_out = f_out if f_out is not None else os .dup (1 )
188188
189189 def get_reader (self ):
190190 if self .reader is None :
Original file line number Diff line number Diff line change 44
55
66def test_raw_input ():
7- readline_wrapper = _ReadlineWrapper ()
87 master , slave = pty .openpty ()
9- readline_wrapper . f_in = slave
8+ readline_wrapper = _ReadlineWrapper ( slave , slave )
109 os .write (master , b'input\n ' )
11- result = readline_wrapper .raw_input ('prompt:' )
10+
11+ result = readline_wrapper .get_reader ().readline ()
12+ #result = readline_wrapper.raw_input('prompt:')
1213 assert result == 'input'
1314 # A bytes string on python2, a unicode string on python3.
1415 assert isinstance (result , str )
You can’t perform that action at this time.
0 commit comments