Ticket #2219 defect closed duplicate

Opened 7 years ago

Last modified 6 years ago

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) (diff)

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

class IsInIOThread( unittest.TestCase ):

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

Attachments

trial.patch Download (0.8 KB) - added by sifu 7 years ago.
path for scripts/trial.py

Change History

Changed 7 years ago by sifu

path for scripts/trial.py

1

Changed 7 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)

2

Changed 6 years ago by exarkun

  • description modified (diff)

Fixing description markup

3

Changed 6 years ago by exarkun

  • status changed from new to closed
  • resolution set to duplicate

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)

4

Changed 3 years ago by <automation>

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