Skip to content

Tkinter: test_configure_screen should only run on X11 #104461

Description

@chrstphrchvz

test_configure_screen uses the DISPLAY environment variable, which is only relevant to X11; and the purpose of the test is to set the -screen option for a toplevel, which is only useful on Tk for X11, since Tk for the Win32 or Aqua windowing systems only support a single “screen” (called :0 by default).

I use XQuartz installed from MacPorts, and so the DISPLAY environment variable is usually set. test_configure_screen tries to use DISPLAY even if I am running the test on Tk Aqua:

======================================================================
ERROR: test_configure_screen (test.test_tkinter.test_widgets.ToplevelTest.test_configure_screen)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/user/git/cpython/Lib/test/test_tkinter/test_widgets.py", line 86, in test_configure_screen
    widget2 = self.create(screen=display)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/git/cpython/Lib/test/test_tkinter/test_widgets.py", line 69, in create
    return tkinter.Toplevel(self.root, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/git/cpython/Lib/tkinter/__init__.py", line 2678, in __init__
    BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra)
  File "/Users/user/git/cpython/Lib/tkinter/__init__.py", line 2629, in __init__
    self.tk.call(
_tkinter.TclError: couldn't connect to display "/private/tmp/com.apple.launchd.yqEvGPTxFm/org.macports:0"

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions