Skip to content

Commit 0b31ca4

Browse files
authored
Merge pull request #21340 from github/copilot/sub-pr-21339
Centralize mono/nuget platform skip predicate in conftest.py
2 parents 5cf281a + 60b8213 commit 0b31ca4

File tree

5 files changed

+27
-38
lines changed
  • csharp/ql/integration-tests/posix

5 files changed

+27
-38
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import runs_on
2+
3+
4+
def _supports_mono_nuget():
5+
"""
6+
Helper function to determine if the current platform supports Mono and nuget.
7+
8+
Returns True if running on Linux or on macOS x86_64 (excluding macos-15 and macos-26).
9+
macOS ARM runners (macos-15 and macos-26) are excluded due to issues with Mono and nuget.
10+
"""
11+
return (
12+
runs_on.linux
13+
or (
14+
runs_on.macos
15+
and runs_on.x86_64
16+
and not runs_on.macos_15
17+
and not runs_on.macos_26
18+
)
19+
)

csharp/ql/integration-tests/posix/standalone_dependencies_no_framework/test.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
1-
import runs_on
21
import pytest
32
import os
3+
from conftest import _supports_mono_nuget
44

55

6-
# Skipping the test on the ARM runners, macos-15 and macos-26, as we're running
7-
# into trouble with Mono and nuget.
8-
@pytest.mark.only_if(
9-
runs_on.linux
10-
or (runs_on.macos and runs_on.x86_64
11-
and not runs_on.macos_15 and not runs_on.macos_26)
12-
)
6+
@pytest.mark.only_if(_supports_mono_nuget())
137
def test(codeql, csharp):
148
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_DOTNET_FRAMEWORK_REFERENCES"] = (
159
"/non-existent-path"

csharp/ql/integration-tests/posix/standalone_dependencies_nuget with_space/test.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import os
2-
import runs_on
32
import pytest
3+
from conftest import _supports_mono_nuget
44

55

6-
# Skipping the test on the ARM runners, macos-15 and macos-26, as we're running
7-
# into trouble with Mono and nuget.
8-
@pytest.mark.only_if(
9-
runs_on.linux
10-
or (runs_on.macos and runs_on.x86_64
11-
and not runs_on.macos_15 and not runs_on.macos_26)
12-
)
6+
@pytest.mark.only_if(_supports_mono_nuget())
137
def test(codeql, csharp):
148
# making sure we're not doing any fallback restore:
159
os.environ["CODEQL_EXTRACTOR_CSHARP_BUILDLESS_NUGET_FEEDS_CHECK_FALLBACK_TIMEOUT"] = "1"
Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
import runs_on
21
import pytest
2+
from conftest import _supports_mono_nuget
33

44

5-
# Skipping the test on the ARM runners, macos-15 and macos-26, as we're running
6-
# into trouble with Mono and nuget.
7-
@pytest.mark.only_if(
8-
runs_on.linux
9-
or (
10-
runs_on.macos
11-
and runs_on.x86_64
12-
and not (
13-
runs_on.macos_15
14-
or runs_on.macos_26
15-
)
16-
)
17-
)
5+
@pytest.mark.only_if(_supports_mono_nuget())
186
def test(codeql, csharp):
197
codeql.database.create(build_mode="none")
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
import runs_on
21
import pytest
2+
from conftest import _supports_mono_nuget
33

44

5-
# Skipping the test on the ARM runners, macos-15 and macos-26, as we're running
6-
# into trouble with Mono and nuget.
7-
@pytest.mark.only_if(
8-
runs_on.linux
9-
or (runs_on.macos and runs_on.x86_64
10-
and not runs_on.macos_15 and not runs_on.macos_26)
11-
)
5+
@pytest.mark.only_if(_supports_mono_nuget())
126
def test(codeql, csharp):
137
codeql.database.create(source_root="proj", build_mode="none")

0 commit comments

Comments
 (0)