Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add interactive console tests #72404

Closed
zooba opened this issue Sep 20, 2016 · 4 comments
Closed

Add interactive console tests #72404

zooba opened this issue Sep 20, 2016 · 4 comments
Assignees
Labels
3.7 (EOL) end of life OS-windows tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@zooba
Copy link
Member

zooba commented Sep 20, 2016

BPO 28217
Nosy @pfmoore, @tjguk, @zware, @eryksun, @zooba
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • conin.py
  • conout.py
  • 28217_1.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/zooba'
    closed_at = <Date 2016-10-03.16:13:41.362>
    created_at = <Date 2016-09-20.17:44:27.172>
    labels = ['3.7', 'type-feature', 'tests', 'OS-windows']
    title = 'Add interactive console tests'
    updated_at = <Date 2017-03-31.16:36:19.487>
    user = 'https://github.com/zooba'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:19.487>
    actor = 'dstufft'
    assignee = 'steve.dower'
    closed = True
    closed_date = <Date 2016-10-03.16:13:41.362>
    closer = 'steve.dower'
    components = ['Tests', 'Windows']
    creation = <Date 2016-09-20.17:44:27.172>
    creator = 'steve.dower'
    dependencies = []
    files = ['44764', '44765', '44895']
    hgrepos = []
    issue_num = 28217
    keywords = ['patch']
    message_count = 4.0
    messages = ['277049', '277078', '277763', '277963']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'python-dev', 'zach.ware', 'eryksun', 'steve.dower']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue28217'
    versions = ['Python 3.6', 'Python 3.7']

    @zooba
    Copy link
    Member Author

    zooba commented Sep 20, 2016

    We can test the interactive console by opening new console buffers (CONIN$ and CONOUT$) in the test process, then creating a subprocess with those set as the standard handles. Now we can use WriteConsoleInput from the test process to simulate the user typing at the console.

    This would be useful for verifying that Unicode support works properly and that the interactive mode behaves correctly.

    @zooba zooba added 3.7 (EOL) end of life tests Tests in the Lib/test dir OS-windows type-feature A feature request or enhancement labels Sep 20, 2016
    @eryksun
    Copy link
    Contributor

    eryksun commented Sep 20, 2016

    Here's the ctypes code (mentioned on bpo-1602) for writing to the input buffer and reading from the screen buffer. For output testing I also have a context manager to create and temporarily activate a new screen buffer with a given number of columns and rows and filled with a particular character (e.g. NUL), which makes it easier to read the output up to the current cursor position.

    Activating the new screen can be factored out if you're just testing a child writing to stdout. I added the screen activation part in order to read the output from a program that was stubbornly writing to CONOUT$, ignoring the pipe that was passed as stdout.

    @zooba zooba self-assigned this Sep 28, 2016
    @zooba
    Copy link
    Member Author

    zooba commented Sep 30, 2016

    Added my work on this so far. I've only done input testing, but that's the more important one anyway in my opinion.

    Feel free to suggest more edge cases we ought to test and I'll try and get to adding them before b2.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Oct 3, 2016

    New changeset 363888141f41 by Steve Dower in branch '3.6':
    Issue bpo-28217: Adds _testconsole module to test console input. Fixes some issues found by the tests.
    https://hg.python.org/cpython/rev/363888141f41

    New changeset 3ec6a610e93e by Steve Dower in branch 'default':
    Issue bpo-28217: Adds _testconsole module to test console input.
    https://hg.python.org/cpython/rev/3ec6a610e93e

    @zooba zooba closed this as completed Oct 3, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life OS-windows tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants