Skip to content

Conversation

@cincodenada
Copy link
Contributor

Description

Adds a simple check to skip a darwin-only test on non-darwin platforms

Related Issue

#2318

Motivation and Context

I want to be able to run the tests on my Linux machine :)

How Has This Been Tested?

Ran tests, they all ran except for the darwin one which was skipped as expected

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@m3nu
Copy link
Contributor

m3nu commented Dec 17, 2025

Thanks for the fix. The right thing to skip this conditionally. I do wonder why tests aren't failing on Github. Much of the output is already mocked. Maybe due to different versions used somewhere.

@cincodenada
Copy link
Contributor Author

cincodenada commented Dec 18, 2025

Ya know I was curious about why it wasn't failing in the Github tests too, and so I just looked into it a bit, and pretty sure it's becuase we're just not running this test at all in the Github actions. Looks like the Actions explicitly run make test-unit and make test-integration, but this test (and one other for NetworkManager) are a secret third category of tests, network_manager, which doesn't have a corresponding Makefile command.

I wonder if the Github runners even have enough of a desktop environment to have the network_manager tests even do anything, come to think of it. May be worth a shot though, I guess.

@m3nu
Copy link
Contributor

m3nu commented Dec 18, 2025

That's likely the reason. The network tests didn't work on GH so they put them separately. You can still run them locally with uv run pytest tests/... Can you add the skipping to both. Like this:

For test_darwin.py (macOS only):

import sys
pytestmark = pytest.mark.skipif(sys.platform != 'darwin', reason="macOS only")

For test_network_manager.py (Linux only):

import sys
pytestmark = pytest.mark.skipif(sys.platform != 'linux', reason="Linux only")

This applies the skip condition to all tests in the file automatically. When you run tests on the wrong platform, pytest will skip the entire file with the reason displayed. Source

@m3nu m3nu merged commit f96fb67 into borgbase:master Dec 22, 2025
4 of 5 checks passed
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.

2 participants