Skip to content

PEP 475: port test_eintr to Windows #67907

Closed

Description

@vstinner
BPO 23719
Nosy @vstinner, @tjguk, @zware, @zooba
Files
  • win32-sleep-test.diff
  • 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 = None
    closed_at = <Date 2017-11-24.01:32:23.149>
    created_at = <Date 2015-03-20.12:09:51.429>
    labels = ['tests', 'OS-windows']
    title = 'PEP 475: port test_eintr to Windows'
    updated_at = <Date 2017-11-24.01:32:23.147>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2017-11-24.01:32:23.147>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-11-24.01:32:23.149>
    closer = 'vstinner'
    components = ['Tests', 'Windows']
    creation = <Date 2015-03-20.12:09:51.429>
    creator = 'vstinner'
    dependencies = []
    files = ['38976']
    hgrepos = []
    issue_num = 23719
    keywords = ['patch']
    message_count = 4.0
    messages = ['238652', '240823', '249631', '306873']
    nosy_count = 5.0
    nosy_names = ['jpe', 'vstinner', 'tim.golden', 'zach.ware', 'steve.dower']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue23719'
    versions = ['Python 3.5']

    Activity

    1. vstinner commented on Mar 20, 2015

      @vstinner
      MemberAuthor

      Currently, test_eintr is complelty skipped on Windows. time.sleep() was also patched on Windows to retry when interrupted by a signal (issue bpo-23646) and I was able to see a different when testing manually.

      test_eintr is currently implemented with signal.setitimer() and os.fork(). Windows doesn't have signal.setitimer(), signal.alarm(), nor os.fork(), but it's possible to send a signal to another process using os.kill() (by the way, see the issue bpo-14484 "missing return in win32_kill?").

      At least, time.sleep() should be tested on Windows.

    2. jpe commented on Apr 14, 2015

      jpemannequin
      Mannequin

      Here's the 1st draft of a test for interrupts during time.sleep(). It creates a thread to generate the ctrl-c events which seems to work well (note that kill() on win32 is quite limited in terms of sending events to other processes). The creation and use of the subthread probably could be improved. I also needed to add a way of specifying creationflags for a subprocess so a new console could be created; otherwise the parent test process is also interrupted by the ctrl-c.

      I have not tested the modified test on a non-win32 platform

    3. vstinner commented on Sep 3, 2015

      @vstinner
      MemberAuthor

      The change ed0e6a9c11af replaced os.fork() with subprocess to try to fix race conditions in test_eintr (the test sometimes hangs on FreeBSD buildbots). os.fork() is not available on Windows, so this change should help to port test_eintr to Windows.

      About win32-sleep-test.diff: I'm not sure that it's a good idea to introduce a new thread in test_eintr. Signal handlers is more complex when we have multiple threads. Would it be possible to spawn a new process which will send a signal every N seconds to its parent?

    4. vstinner commented on Nov 24, 2017

      @vstinner
      MemberAuthor

      Sorry, I lost track of this idea, and I was unable to review win32-sleep-test.diff :-( While it would be "nice to have", the code is well tested on Unix. I close the issue.

    5. 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

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions