Centralize mono/nuget platform skip predicate in conftest.py#21340
Centralize mono/nuget platform skip predicate in conftest.py#21340oscarsj merged 3 commits intooscarsj/skip-csharp-integration-on-macos-26from
Conversation
Co-authored-by: oscarsj <1410188+oscarsj@users.noreply.github.com>
Co-authored-by: oscarsj <1410188+oscarsj@users.noreply.github.com>
0b31ca4
into
oscarsj/skip-csharp-integration-on-macos-26
There was a problem hiding this comment.
Pull request overview
Centralizes a repeated pytest skip predicate for Mono/nuget support into a shared helper to keep macOS ARM runner exclusions consistent across C# integration tests.
Changes:
- Added
csharp/ql/integration-tests/posix/conftest.pywith_supports_mono_nuget()helper. - Updated four tests to use the shared helper instead of inline predicates.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| csharp/ql/integration-tests/posix/conftest.py | Introduces shared platform-support predicate for Mono/nuget. |
| csharp/ql/integration-tests/posix/standalone_dependencies_no_framework/test.py | Uses shared predicate for conditional test execution. |
| csharp/ql/integration-tests/posix/standalone_dependencies_nuget/test.py | Uses shared predicate for conditional test execution. |
| csharp/ql/integration-tests/posix/standalone_dependencies_nuget with_space/test.py | Uses shared predicate for conditional test execution. |
| csharp/ql/integration-tests/posix/standalone_dependencies_nuget_no_sources/test.py | Uses shared predicate for conditional test execution. |
| from conftest import _supports_mono_nuget | ||
|
|
||
|
|
There was a problem hiding this comment.
Importing from conftest.py is discouraged in pytest because conftest is a special discovery file (loaded by path), and importing it as a module can lead to confusing behavior (e.g., it not being importable in some runners, or being loaded inconsistently). Consider moving _supports_mono_nuget() to a regular helper module (e.g., mono_nuget_support.py / platform_support.py) and importing from that module instead.
| from conftest import _supports_mono_nuget | |
| import shutil | |
| def _supports_mono_nuget() -> bool: | |
| """ | |
| Return True if the current environment appears to support running C# via | |
| Mono and NuGet. This checks for the presence of the corresponding | |
| executables on PATH. | |
| """ | |
| return shutil.which("mono") is not None and shutil.which("nuget") is not None |
| import runs_on | ||
|
|
||
|
|
||
| def _supports_mono_nuget(): |
There was a problem hiding this comment.
The leading underscore implies a private helper, but it’s imported and used by multiple test modules. Consider renaming it to supports_mono_nuget (no leading underscore) to reflect its intended shared usage.
| def _supports_mono_nuget(): | ||
| """ | ||
| Helper function to determine if the current platform supports Mono and nuget. | ||
|
|
There was a problem hiding this comment.
The docstring contains a whitespace-only line (line 7). Consider removing the trailing spaces/empty whitespace line to satisfy common linters and keep formatting clean.
The skip predicate for macOS ARM runners (macos-15, macos-26) was duplicated across four C# integration test files with identical logic and comments.
Changes
csharp/ql/integration-tests/posix/conftest.pywith a shared_supports_mono_nuget()helper functionstandalone_dependencies_no_framework/test.pystandalone_dependencies_nuget/test.pystandalone_dependencies_nuget with_space/test.pystandalone_dependencies_nuget_no_sources/test.pyBefore:
After:
This ensures the excluded macOS version list stays consistent across all affected tests.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.