Skip to content

Add interactive console tests #72404

Closed
Closed

Description

@zooba
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']

    Activity

    1. zooba commented on Sep 20, 2016

      @zooba
      MemberAuthor

      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.

    2. eryksun commented on Sep 20, 2016

      @eryksun
      Contributor

      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.

    3. self-assigned this
      on Sep 28, 2016
    4. zooba commented on Sep 30, 2016

      @zooba
      MemberAuthor

      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.

    5. python-dev commented on Oct 3, 2016

      python-devmannequin
      Mannequin

      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

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions