Skip to content

Commit 642bb3b

Browse files
committed
Guard Windows-only tests for cross-platform CI
1 parent 6072709 commit 642bb3b

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎tests/BioFSharp.Mz.Tests/PercolatorWrapperTests.fs‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ open System.IO
44
open Expecto
55
open BioFSharp.Mz
66

7+
// active on Windows, pending elsewhere: drive-letter FileInfo fixtures resolve cwd-relative on Unix
8+
let private windowsOnlyTestCase name test =
9+
if System.OperatingSystem.IsWindows() then testCase name test
10+
else ptestCase name test
11+
712
[<Tests>]
813
let tests =
914
testList "PercolatorWrapperTests" [
10-
testCase "fileInfoToWindowsPath returns the full native path" <| fun _ ->
15+
windowsOnlyTestCase "fileInfoToWindowsPath returns the full native path" <| fun _ ->
1116
let fi = FileInfo(@"C:\Data\run.pin")
1217
Expect.equal
1318
(PercolatorWrapper.Parameters.fileInfoToWindowsPath fi)
1419
@"C:\Data\run.pin"
1520
"FileInfo.FullName is the native full path"
16-
// the input path is already canonical, so Windows conversion must be the identity on it - asserted against the literal, not against FileInfo.FullName (which would compare the implementation with itself). Windows-only fixture (drive paths resolve differently on Linux); tests do not run on the ubuntu docs workflow.
21+
// the input path is already canonical, so Windows conversion must be the identity on it - asserted against the literal, not against FileInfo.FullName (which would compare the implementation with itself). Windows-only fixture (drive paths resolve differently on Linux), hence the platform guard: CI runs the suite on ubuntu too.
1722

18-
testCase "fileInfoToLinuxPath maps a drive-letter path to its WSL mount" <| fun _ ->
23+
windowsOnlyTestCase "fileInfoToLinuxPath maps a drive-letter path to its WSL mount" <| fun _ ->
1924
Expect.equal
2025
(PercolatorWrapper.Parameters.fileInfoToLinuxPath (FileInfo(@"C:\Data\run.pin")))
2126
"/mnt/c/Data/run.pin"
@@ -53,6 +58,7 @@ let tests =
5358
// serializer emits converted paths UNQUOTED, so standard Windows argument parsing splits them
5459
// into multiple operands - percolator receives a broken file reference. Argued-correct: the
5560
// serialized fragment must carry the full path as one operand (quoted).
61+
// Windows-only like the guarded tests above: it exercises the real fileInfoToWindowsPath, not a stub converter.
5662
ptestCase "converted paths containing spaces remain single command-line operands" <| fun _ ->
5763
let s =
5864
PercolatorWrapper.Parameters.stringOf

‎tests/BioFSharp.Mz.Tests/ProteinInferenceVisTests.fs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ let private withTempDirectory f =
7474
Directory.Delete(tempDir, true)
7575
with _ -> ()
7676

77+
// active on Windows, pending elsewhere: the guarded test pins grouped-report placement that only
78+
// holds where the implementation's backslash concatenation is a path separator
79+
let private windowsOnlyTestCase name test =
80+
if System.OperatingSystem.IsWindows() then testCase name test
81+
else ptestCase name test
82+
7783
[<Tests>]
7884
let tests =
7985
testList "ProteinInferenceVisTests" [
@@ -93,7 +99,7 @@ let tests =
9399
// The documented single-file naming convention appends "_QValueGraph" to the base path (Plotly's SaveHtmlAs adds the .html extension); the observable contract of a visualization function is that it produces the report file where callers will look for it.
94100
)
95101

96-
testCase "qValueHitsVisualization with groupFiles=true writes the report inside the target folder" <| fun _ ->
102+
windowsOnlyTestCase "qValueHitsVisualization with groupFiles=true writes the report inside the target folder" <| fun _ ->
97103
withTempDirectory (fun tempDir ->
98104
let basePath = Path.Combine(tempDir, "run2")
99105
Directory.CreateDirectory(basePath) |> ignore
@@ -111,7 +117,8 @@ let tests =
111117
// Path.Combine, which is byte-identical to the implementation's literal backslash on Windows
112118
// but would correctly FAIL on Unix, where the current code writes a file literally named
113119
// "dir\QValueGraph.html" beside the folder. A string-identical assertion would bless that
114-
// bug on every platform.
120+
// bug on every platform. The platform guard keeps the test active only on Windows, where
121+
// the placement contract holds.
115122
)
116123

117124
// PENDING: relative frequencies of the decoy histogram must sum to 1 over the DECOYS. The

0 commit comments

Comments
 (0)