Author martin.panter
Recipients martin.panter, twouters, tylercrompton
Date 2016-05-08.08:56:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1462697794.42.0.938598337478.issue26870@psf.upfronthosting.co.za>
In-reply-to
Content
I left a few minor comments in the code review.

I agree automated testing would be awkward for Readline. It should be possible using a pseudoterminal (pty). In fact there is already very basic testing that does this in /Lib/test/test_builtin.py, class PtyTests. It only tests the input() prompt.

I could have a go at writing a test. I guess pseudocode for a test would look a bit like:

def run_pty(script):
    [master, slave] = pty.openpty()
    with subprocess.Popen(script, stdin=slave, stdout=slave, stderr=slave)
        # Read and write concurrently like proc.communicate()
        master.write(b"dummy input\r")
        return slave.read()

template = """\
import readline
readline.set_auto_history({})
input()
print("History length:", readline.get_current_history_length())
"""

def test_auto_history_enabled(self):
    output = run_session(template.format(True))
    self.assertIn(b"History length: 1\n", output)

def test_auto_history_disabled(self):
    output = run_session(template.format(False))
    self.assertIn(b"History length: 0\n", output)
History
Date User Action Args
2016-05-08 08:56:34martin.pantersetrecipients: + martin.panter, twouters, tylercrompton
2016-05-08 08:56:34martin.pantersetmessageid: <1462697794.42.0.938598337478.issue26870@psf.upfronthosting.co.za>
2016-05-08 08:56:34martin.panterlinkissue26870 messages
2016-05-08 08:56:33martin.pantercreate