Skip to content

[BugFix] Skip TestGatherLayer_Losses on macOS#1922

Open
RecreationalMath wants to merge 4 commits into
lightly-ai:masterfrom
RecreationalMath:macos-test-fast
Open

[BugFix] Skip TestGatherLayer_Losses on macOS#1922
RecreationalMath wants to merge 4 commits into
lightly-ai:masterfrom
RecreationalMath:macos-test-fast

Conversation

@RecreationalMath

Copy link
Copy Markdown
Contributor

closes #1917

Description

TestGatherLayer_Losses uses DDPStrategy(devices=2) under pytest. On macOS the spawn start method causes the DDP worker child to re-import the test module and block on pytest's fixture machinery, while the parent waits for the child to join the DDP process group. The suite hangs indefinitely with no error.

The same class is already skipped on GitHub Actions via pytest.mark.skipif for codecov reasons, so this PR adds sys.platform == "darwin" to that condition. Empirical reproduction (~40 runs) and root-cause analysis are in the issue thread.

Manual verification on macOS 26.4.1 (arm64):

  • pytest tests/utils/test_dist__gather__losses.py -v: 4 skipped, no hang (5.8s).
  • make test-fast: 1560 passed, 258 skipped, no hang (3:30).
  • make format: ruff clean.

No documentation changes required: this is a test-file skip-condition adjustment with no public API or docs surface.

Tests

  • I have updated the tests.
  • I need help on it.

TestGatherLayer_Losses uses DDPStrategy(devices=2) under
pytest. On macOS, the spawn start method causes the DDP worker
child to re-import the test module and block on pytest fixture
machinery, while the parent waits for the child to join the
DDP process group. The result is make test-fast hanging
indefinitely with no output.

The same class is already skipped on GitHub Actions for codecov
reasons. Adding macOS to the existing condition removes
the local hang without changing CI coverage
@RecreationalMath

Copy link
Copy Markdown
Contributor Author

@liopeer, could you please initiate the test run and review this? Thanks!

@gabrielfruet

Copy link
Copy Markdown
Contributor

Thank you for the PR! Sorry for the delay. I'll try to review it this week!

@gabrielfruet

Copy link
Copy Markdown
Contributor

/review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 prevents a macOS-only hang in the test suite by extending an existing skip condition for TestGatherLayer_Losses to also skip on sys.platform == "darwin", matching the issue’s described DDP spawn/pytest interaction deadlock.

Changes:

  • Add sys import for platform detection.
  • Expand pytest.mark.skipif condition to skip on macOS in addition to GitHub Actions.
  • Update the skip reason message to document both skip causes (codecov on GHA, DDP spawn deadlock on macOS).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.23%. Comparing base (7675dda) to head (b78ad7c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1922   +/-   ##
=======================================
  Coverage   86.23%   86.23%           
=======================================
  Files         169      169           
  Lines        7105     7105           
=======================================
  Hits         6127     6127           
  Misses        978      978           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RecreationalMath

Copy link
Copy Markdown
Contributor Author

The failed CI job died during the dependency install step, not a code/test failure.
Re-running the job should suffice.

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.

[BUG] macOS: make test-fast hangs indefinitely

3 participants