Skip to content

Commit

Permalink
gtk3: remove test for the DISPLAY variable
Browse files Browse the repository at this point in the history
As the code does not depend on this variable any more,
testing for it does not make sense.

There might be more logic to remove, since
4142aee
introduced it.
  • Loading branch information
muelli committed Sep 10, 2020
1 parent 41d21ed commit aa04af3
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions src/twisted/internet/test/test_gireactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"""


import os
import sys
from unittest import skipIf
try:
Expand All @@ -27,11 +26,9 @@
gtk3reactor = _gtk3reactor
from gi.repository import Gtk

from twisted.python.runtime import platform
from twisted.internet.error import ReactorAlreadyRunning
from twisted.trial.unittest import TestCase, SkipTest
from twisted.internet.test.reactormixins import ReactorBuilder
from twisted.test.test_twisted import SetAsideModule

# Skip all tests if gi is unavailable:
if gireactor is None:
Expand Down Expand Up @@ -187,29 +184,3 @@ def test_compatibilityLayer(self):
raise SkipTest("This version of gi doesn't include pygtkcompat.")
import gobject
self.assertTrue(gobject.__name__.startswith("gi."))



class Gtk3ReactorTests(TestCase):
"""
Tests for L{gtk3reactor}.
"""

@skipIf(platform.getType() != "posix" or platform.isMacOSX(),
"This test is only relevant when using X11")
def test_requiresDISPLAY(self):
"""
On X11, L{gtk3reactor} is unimportable if the C{DISPLAY} environment
variable is not set.
"""
display = os.environ.get("DISPLAY", None)
if display is not None:
self.addCleanup(os.environ.__setitem__, "DISPLAY", display)
del os.environ["DISPLAY"]
with SetAsideModule("twisted.internet.gtk3reactor"):
exc = self.assertRaises(ImportError,
__import__, "twisted.internet.gtk3reactor")
self.assertEqual(
exc.args[0],
"Gtk3 requires X11, and no DISPLAY environment "
"variable is set")

0 comments on commit aa04af3

Please sign in to comment.