Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tkinter: test_configure_screen should only run on X11 #104461

Closed
chrstphrchvz opened this issue May 14, 2023 · 2 comments
Closed

Tkinter: test_configure_screen should only run on X11 #104461

chrstphrchvz opened this issue May 14, 2023 · 2 comments

Comments

@chrstphrchvz
Copy link
Contributor

chrstphrchvz commented May 14, 2023

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

@terryjreedy
Copy link
Member

@ned-deily Does proposed fix on PR of adding following at the top of the test seem right to you?

        if widget._windowingsystem != 'x11':
            self.skipTest('Not using Tk for X11')

@ned-deily
Copy link
Member

Does proposed fix on PR of adding following at the top of the test seem right to you?

Yes, it does. I fixed a couple of problems with the NEWS file and then merged the fix to main (for 3.12) and to 3.11. Thanks for the PR, @chrstphrchvz!

carljm added a commit to carljm/cpython that referenced this issue May 16, 2023
* main:
  pythonGH-104510: Fix refleaks in `_io` base types (python#104516)
  pythongh-104539: Fix indentation error in logging.config.rst (python#104545)
  pythongh-104050: Don't star-import 'types' in Argument Clinic (python#104543)
  pythongh-104050: Add basic typing to CConverter in clinic.py (python#104538)
  pythongh-64595: Fix write file logic in Argument Clinic (python#104507)
  pythongh-104523: Inline minimal PGO rules (python#104524)
  pythongh-103861: Fix Zip64 extensions not being properly applied in some cases (python#103863)
  pythongh-69152: add method get_proxy_response_headers to HTTPConnection class (python#104248)
  pythongh-103763: Implement PEP 695 (python#103764)
  pythongh-104461: Run tkinter test_configure_screen on X11 only (pythonGH-104462)
  pythongh-104469: Convert _testcapi/watchers.c to use Argument Clinic (python#104503)
  pythongh-104482: Fix error handling bugs in ast.c (python#104483)
  pythongh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (pythongh-104437)
  pythonGH-102613: Fix recursion error from `pathlib.Path.glob()` (pythonGH-104373)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants