Skip to content

Clean up skipped tests and document those still needed for win32 #5812

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

arogl
Copy link
Contributor

@arogl arogl commented Jun 1, 2025

Description

Marked tests needing not to be tested on windows.

Documented why tests need to be skipped IF the code is not logical.

Most tests are more to how windows manages the filesystem compared to *nix & MacOS

The test_player tests, I have completely skipped as I think the failures are lack of sockets being easily used for the tests.

To Do

A few tests still create files in the local folder rather than in TEMP. I'll add those as updates, but looking for feedback on changes?

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

@snejus snejus requested a review from Copilot June 24, 2025 11:04
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR marks and documents tests that fail on Windows (and WSL on NTFS) so they are gracefully skipped, adds helper functions to detect WSL/NTFS environments, and updates the changelog accordingly.

  • Added @unittest.skipIf and pytest.mark.skipif decorators to skip Windows-specific tests.
  • Introduced is_wsl, is_path_on_ntfs, and is_wsl_and_ntfs helpers to support skipping on WSL/NTFS.
  • Updated docs/changelog.rst to record the new test skips.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/test_ui.py Skips UI tests on Windows with FIXME comments
test/test_release.py Skips RST-to-MD conversion test on Windows
test/test_query.py Removed some Windows skips to re-enable tests on Windows
test/plugins/test_player.py Uses pytest.mark.skipif to skip socket-based player tests on Windows
test/plugins/test_play.py Skips relative-path play test on Windows with new comment
test/plugins/test_permissions.py Imports is_wsl_and_ntfs to skip permission tests on WSL/NTFS
test/plugins/test_convert.py Skips convert plugin tests on Windows with pytest decorator
docs/changelog.rst Notes skipped Windows and WSL/NTFS tests
beets/test/helper.py Adds WSL/NTFS detection utilities
Comments suppressed due to low confidence (1)

test/plugins/test_play.py:80

  • [nitpick] This comment is vague. Clarify exactly why the test must be skipped on Windows (e.g., explain how drive-root semantics differ).
    # more joys of Windows not having a root start unless you only have 1 drive

print(f"Error reading /proc/mounts: {e}")
return False

return fs_type.lower() == "9p"
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

The NTFS detection is comparing the filesystem type to "9p", but WSL mounts typically use "drvfs" (or a similar fstype). Update this check to detect the actual NTFS mount type.

Suggested change
return fs_type.lower() == "9p"
return fs_type.lower() == "drvfs"

Copilot uses AI. Check for mistakes.

@@ -911,6 +911,9 @@ def test_paths_section_respected(self):
assert key == "x"
assert template.original == "y"

# FIXME: fails on windows as folder is created in current folder rather than
# the tmp dir for testing.
@unittest.skipIf(sys.platform == "win32", "win32")
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

[nitpick] This decorator is repeated on multiple methods. Consider using a module-level pytestmark = pytest.mark.skipif(...) or a class-level decorator to DRY up the Windows skip logic.

Suggested change
@unittest.skipIf(sys.platform == "win32", "win32")

Copilot uses AI. Check for mistakes.

@@ -911,6 +911,9 @@ def test_paths_section_respected(self):
assert key == "x"
assert template.original == "y"

# FIXME: fails on windows as folder is created in current folder rather than
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Capitalize "Windows" in the comment for consistency with platform naming.

Suggested change
# FIXME: fails on windows as folder is created in current folder rather than
# FIXME: fails on Windows as folder is created in current folder rather than

Copilot uses AI. Check for mistakes.

@@ -102,6 +103,8 @@ def md_changelog():
- Fixed something.""" # noqa: E501


# Fixme windows
@unittest.skipIf(sys.platform == "win32", "win32")
Copy link
Preview

Copilot AI Jun 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Tests in this suite use pytest; switch to @pytest.mark.skipif(sys.platform == 'win32', reason='Windows') for consistency with the rest of the test suite.

Suggested change
@unittest.skipIf(sys.platform == "win32", "win32")
@pytest.mark.skipif(sys.platform == "win32", reason="Windows")

Copilot uses AI. Check for mistakes.

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