Opened 8 years ago

Closed 6 years ago

#2219 defect closed duplicate (duplicate)

isInIOThread() returns False when used in TestCases

Reported by: sifu Owned by:
Priority: normal Milestone:
Component: trial Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description (last modified by exarkun)

from twisted.python.threadable import isInIOThread
from twisted.trial import unittest

class IsInIOThread( unittest.TestCase ):

    def test_isInIOThread( self ):
        self.assertEquals( isInIOThread( ), True )

Attachments (1)

trial.patch (797 bytes) - added by sifu 8 years ago.
path for scripts/trial.py

Download all attachments as: .zip

Change History (5)

Changed 8 years ago by sifu

path for scripts/trial.py

comment:1 Changed 8 years ago by sifu

this patch fixes it, and doesn't seem to break anything :)

eg: trial on twisted/test:
PASSED (skips=31, expectedFailures=7, successes=990)

comment:2 Changed 6 years ago by exarkun

  • Description modified (diff)

Fixing description markup

comment:3 Changed 6 years ago by exarkun

  • Resolution set to duplicate
  • Status changed from new to closed

The attached patch is very wrong.

This is probably a duplicate of #1614/#3178.

Consider:

from signal import getsignal, SIGCHLD

from twisted.internet import reactor
from twisted.trial import unittest
from twisted.python.threadable import isInIOThread
from twisted.internet.task import deferLater

class ReactorIsNotRunning(unittest.TestCase):
    def test_reactorIsRunning(self):
        print reactor.running
        print getsignal(SIGCHLD)
        print isInIOThread()


class ReactorIsRunning(ReactorIsNotRunning):
    def setUp(self):
        return deferLater(reactor, 0, lambda: None)

comment:4 Changed 4 years ago by <automation>

  • Owner jml deleted
Note: See TracTickets for help on using tickets.