Skip to content

Commit 004ebd3

Browse files
Copilotoscarsj
andcommitted
Centralize mono/nuget skip predicate in conftest.py
Co-authored-by: oscarsj <1410188+oscarsj@users.noreply.github.com>
1 parent 9efe112 commit 004ebd3

File tree

5 files changed

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

5 files changed

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

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)