Skip to content

Commit 95e7335

Browse files
pkazakov-devForNeVeR
authored andcommitted
Add Utils.RunsOnCi
1 parent a9b978e commit 95e7335

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

TruePath.Tests/AbsolutePathTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024-2026 Friedrich von Never <friedrich@fornever.me>
1+
// SPDX-FileCopyrightText: 2024-2026 TruePath contributors <friedrich@fornever.me>
22
//
33
// SPDX-License-Identifier: MIT
44

@@ -95,8 +95,8 @@ public void ReadKind_IsSymlink()
9595
{
9696
Directory.CreateSymbolicLink(currentDirectory, tempDirectoryInfo);
9797
}
98-
catch (IOException e) when (OperatingSystem.IsWindows()) // && !TestFramework.RunsOnCi())
99-
{ // TODO: Implement `TestFramework.RunsOnCi`
98+
catch (IOException e) when (OperatingSystem.IsWindows() && !Utils.RunsOnCi())
99+
{
100100
if (e.Message.Contains("privilege") && (e.StackTrace?.Contains("CreateSymbolicLink") ?? false))
101101
{
102102
Assert.Skip("Tests involving symlink creation require elevated privileges on Windows, as this is enforced at the OS level.");

TruePath.Tests/Utils.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2024 TruePath contributors <https://github.com/ForNeVeR/TruePath>
1+
// SPDX-FileCopyrightText: 2024-2026 TruePath contributors <https://github.com/ForNeVeR/TruePath>
22
//
33
// SPDX-License-Identifier: MIT
44

@@ -22,4 +22,9 @@ internal static string ToNonCanonicalCase(this string path)
2222

2323
return nonCanonicalPath;
2424
}
25+
26+
internal static bool RunsOnCi()
27+
{
28+
return Environment.GetEnvironmentVariable("CI") is not null;
29+
}
2530
}

0 commit comments

Comments
 (0)