Skip to content

Commit

Permalink
add test for gtk aliases for import/coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
glyph committed Oct 6, 2022
1 parent 8f00f66 commit c694ec3
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/twisted/internet/test/test_gireactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
if not giImported:
skip = "GObject Introspection `gi` module not importable"

noGtkSkip = (gtkVersion is None) or (gtkVersion not in ("3.0", "4.0"))
noGtkMessage = f"Unknown GTK version: {repr(gtkVersion)}"


class GApplicationRegistrationTests(ReactorBuilder, TestCase):
"""
Expand Down Expand Up @@ -95,10 +98,23 @@ def test_gApplicationActivate(self):

self.runReactor(app, reactor)

@skipIf(
((gtkVersion is None) or (gtkVersion not in ("3.0", "4.0"))),
f"Unknown GTK version: {repr(gtkVersion)}",
)
@skipIf(noGtkSkip, noGtkMessage)
def test_gtkAliases(self) -> None:
"""
L{twisted.internet.gtk3reactor} is now just a set of compatibility
aliases for L{twisted.internet.GIReactor}.
"""
from twisted.internet.gtk3reactor import (
Gtk3Reactor,
PortableGtk3Reactor,
install,
)

self.assertIs(Gtk3Reactor, gireactor.GIReactor)
self.assertIs(PortableGtk3Reactor, gireactor.PortableGIReactor)
self.assertIs(install, gireactor.install)

@skipIf(noGtkSkip, noGtkMessage)
def test_gtkApplicationActivate(self):
"""
L{Gtk.Application} instances can be registered with a gtk3reactor.
Expand Down

0 comments on commit c694ec3

Please sign in to comment.