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):
182
182
startup_hook = None
183
183
config = ReadlineConfig ()
184
184
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 )
188
188
189
189
def get_reader (self ):
190
190
if self .reader is None :
Original file line number Diff line number Diff line change 4
4
5
5
6
6
def test_raw_input ():
7
- readline_wrapper = _ReadlineWrapper ()
8
7
master , slave = pty .openpty ()
9
- readline_wrapper . f_in = slave
8
+ readline_wrapper = _ReadlineWrapper ( slave , slave )
10
9
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:')
12
13
assert result == 'input'
13
14
# A bytes string on python2, a unicode string on python3.
14
15
assert isinstance (result , str )
You can’t perform that action at this time.
0 commit comments