Skip to content

Commit

Permalink
Update src/twisted/internet/test/test_glibbase.py
Browse files Browse the repository at this point in the history
Co-authored-by: Adi Roiban <adiroiban@gmail.com>
  • Loading branch information
doadin and adiroiban committed Feb 7, 2022
1 parent e0e649b commit b9ce4a3
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions src/twisted/internet/test/test_glibbase.py
Expand Up @@ -67,17 +67,34 @@ def test_ensureFailsWhenImported(self):
self.assertEqual(e.args, ("A message.",))



try:
from twisted.internet import gireactor as _gireactor
except ImportError:
gireactor = None
else:
gireactor = _gireactor

missingGlibReactor = None
if gireactor is None:
missingGlibReactor = "gi reactor not available"


class GlibReactorBaseTests(TestCase):
"""
Tests for the private C{twisted.internet._glibbase.GlibReactorBase}
done via the public C{twisted.internet.gireactor.PortableGIReactor}
"""
skip = missingGlibReactor

def test_simulate(self):
""" """
try:
from twisted.internet import gireactor as _gireactor
except ImportError:
gireactor = None
else:
gireactor = _gireactor

if gireactor is None:
self.skipTest("gi reactor not available")

gireactor.install().simulate()
"""
C{simulate} can be called without raising any errors when there are
no delayed calls for the reactor and hence there is no defined sleep
period.
"""
sut = gireactor.PortableGIReactor(usegtk=False)
# Double check that reactor has no sleep period.
self.assertIs(None, sut.timeout())

sut.simulate()

0 comments on commit b9ce4a3

Please sign in to comment.