Skip to content

Conversation

ankith26
Copy link
Member

@ankith26 ankith26 commented Aug 31, 2025

Add skips to tests that fail on wayland. With this PR, we now have all tests passing on wayland on both sdl2 and sdl2-compat.

Also adds documentation to the API that is known to not work with wayland.

@ankith26 ankith26 added this to the 2.5.6 milestone Aug 31, 2025
@ankith26 ankith26 requested a review from a team as a code owner August 31, 2025 11:19
Copy link
Contributor

coderabbitai bot commented Aug 31, 2025

📝 Walkthrough

Walkthrough

Adds Wayland compatibility notes to pygame display/window stub docstrings and introduces Wayland detection in tests to conditionally skip features not supported by the Wayland video driver. One window position test now uses a dynamic position value. No API signatures or runtime code changed.

Changes

Cohort / File(s) Summary
Stub docstring updates
buildconfig/stubs/pygame/display.pyi, buildconfig/stubs/pygame/window.pyi
Augment docstrings to note potential lack of support on some drivers (e.g., Wayland) and possible pygame.error; no signature changes.
Wayland-gated display tests
test/display_test.py
Add is_wayland detection and skip several display tests on Wayland (iconify, gamma, window position); retain existing gating.
Wayland-gated event tests
test/event_test.py
Add is_wayland detection; skip grab-related tests on Wayland; minor message formatting change.
Wayland-gated window tests and adjustment
test/window_test.py
Add is_wayland detection; skip always_on_top, position, opacity tests on Wayland; position test now initializes window with dynamic current position and asserts equality.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10–15 minutes

Suggested labels

display

Suggested reviewers

  • MyreMylar
  • Starbuck5

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 91dddfe and 2b6cd9c.

📒 Files selected for processing (5)
  • buildconfig/stubs/pygame/display.pyi (1 hunks)
  • buildconfig/stubs/pygame/window.pyi (2 hunks)
  • test/display_test.py (6 hunks)
  • test/event_test.py (3 hunks)
  • test/window_test.py (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • buildconfig/stubs/pygame/window.pyi
  • buildconfig/stubs/pygame/display.pyi
  • test/window_test.py
  • test/event_test.py
  • test/display_test.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: x86
  • GitHub Check: AMD64
  • GitHub Check: Debian (Bookworm - 12) [armv7]
  • GitHub Check: aarch64
  • GitHub Check: i686
  • GitHub Check: x86_64
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.14.0rc1)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.9.23)
  • GitHub Check: Debian (Bookworm - 12) [armv6]
  • GitHub Check: msys2 (mingw64, x86_64)
  • GitHub Check: msys2 (clang64, clang-x86_64)
  • GitHub Check: msys2 (ucrt64, ucrt-x86_64)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.13.5)
  • GitHub Check: dev-check
  • GitHub Check: Debian (Bookworm - 12) [s390x]
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: Debian (Bookworm - 12) [ppc64le]
  • GitHub Check: build (macos-14)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-22.04)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ankith26-wayland-skips

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (8)
buildconfig/stubs/pygame/display.pyi (1)

748-750: Docstring note on Wayland support looks good

Clear and accurate. No API change; the :exc: markup is correct. Consider mirroring this note anywhere else you document window positioning to keep consistency across the API.

test/surface_test.py (2)

379-383: Confirm version gate matches real sdl2-compat/SDL3 runtime values

Please verify that pygame.version.SDL indeed reports >= (2, 32, 50) for all sdl2-compat builds you target and all SDL3 builds, so these skips reliably trigger where intended. If needed, centralize this predicate into a helper for reuse.


412-416: Same verification for second SDL gate

As above, double-check the threshold, and consider a shared helper constant (e.g., IS_SDL3_OR_COMPAT) to avoid divergence across tests.

buildconfig/stubs/pygame/window.pyi (1)

225-227: Wayland compatibility note for always_on_top

Good addition; matches observed backend behavior. Suggest aligning wording with other notes (“e.g., Wayland”) for consistency.

test/display_test.py (2)

78-79: Wayland-only skip added

Appropriate skip; consider standardizing the message (“not supported on wayland”) across tests.


415-420: Skip iconify on Wayland

Reasonable. Same note on message consistency if you care.

test/window_test.py (2)

14-17: Preserve display init state when detecting the backend

Unconditionally quitting the display after pygame.init() mutates global state and can impact later tests. Preserve/restore only if we had to init it here.

-pygame.display.init()
-is_wayland = pygame.display.get_driver() == "wayland"
-pygame.display.quit()
+_prev_inited = pygame.display.get_init()
+if not _prev_inited:
+    pygame.display.init()
+is_wayland = pygame.display.get_driver() == "wayland"
+if not _prev_inited:
+    pygame.display.quit()

109-109: Capitalize “Wayland” in skip reasons for consistency

Minor wording polish in user-facing skip messages.

-@unittest.skipIf(is_wayland, "not supported on wayland")
+@unittest.skipIf(is_wayland, "not supported on Wayland")

Also applies to: 157-157, 264-264

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c7e9c15 and 91dddfe.

📒 Files selected for processing (6)
  • buildconfig/stubs/pygame/display.pyi (1 hunks)
  • buildconfig/stubs/pygame/window.pyi (2 hunks)
  • test/display_test.py (6 hunks)
  • test/event_test.py (3 hunks)
  • test/surface_test.py (2 hunks)
  • test/window_test.py (5 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-14T02:59:43.863Z
Learnt from: oddbookworm
PR: pygame-community/pygame-ce#0
File: :0-0
Timestamp: 2025-08-14T02:59:43.863Z
Learning: In pygame-ce's C unit testing framework using Unity, the RUN_TEST_PG_INTERNAL macro automatically handles setUp() and tearDown() calls for each test execution, providing automatic test isolation without requiring explicit reset calls between tests.

Applied to files:

  • test/window_test.py
🧬 Code graph analysis (3)
test/window_test.py (3)
buildconfig/stubs/pygame/display.pyi (3)
  • init (105-138)
  • get_driver (345-353)
  • quit (140-148)
buildconfig/stubs/pygame/window.pyi (3)
  • Window (11-500)
  • position (297-305)
  • position (308-308)
src_py/__init__.py (1)
  • Window (380-381)
test/event_test.py (1)
buildconfig/stubs/pygame/display.pyi (3)
  • init (105-138)
  • get_driver (345-353)
  • quit (140-148)
test/display_test.py (2)
src_c/display.c (1)
  • display (3884-3929)
buildconfig/stubs/pygame/display.pyi (3)
  • init (105-138)
  • get_driver (345-353)
  • quit (140-148)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: msys2 (mingw64, x86_64)
  • GitHub Check: msys2 (ucrt64, ucrt-x86_64)
  • GitHub Check: msys2 (clang64, clang-x86_64)
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (macos-14)
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: dev-check
  • GitHub Check: i686
  • GitHub Check: AMD64
  • GitHub Check: x86_64
  • GitHub Check: x86
  • GitHub Check: aarch64
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.13.5)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.9.23)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.14.0rc1)
  • GitHub Check: Debian (Bookworm - 12) [armv7]
  • GitHub Check: Debian (Bookworm - 12) [s390x]
  • GitHub Check: Debian (Bookworm - 12) [armv6]
  • GitHub Check: Debian (Bookworm - 12) [ppc64le]
🔇 Additional comments (8)
buildconfig/stubs/pygame/window.pyi (2)

303-305: Wayland compatibility note for position

Looks correct and consistent with display.set_window_position doc. No further action.


310-314: Expanded opacity doc with Wayland caveat

Accurate and helpful. Thanks for making this explicit.

test/display_test.py (3)

528-529: Gamma test skip on Wayland with SDL3/sdl2-compat gate

Good gating. Keep this in sync with any future backend behavior changes.


547-548: Tuple gamma test skip mirrors single-value case

Looks consistent with the above.


701-708: Window position test skipped on Wayland

Matches the documented limitation; test logic otherwise remains valid.

test/event_test.py (2)

842-847: Wayland skip for set_grab tests

Appropriate; grabbing is not consistently supported on Wayland compositors.


913-916: Wayland skip for get_grab symmetry test

Consistent with the above; LGTM.

test/window_test.py (1)

169-170: LGTM: more robust position assertion

Using the current position to derive a new one avoids brittle hard-coded coords and should behave consistently across WMs.

@ankith26 ankith26 force-pushed the ankith26-wayland-skips branch from 91dddfe to 2b6cd9c Compare September 3, 2025 15:44
@ankith26 ankith26 changed the title Add wayland & sdl2-compat specific skips Add wayland specific skips Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant