@@ -35,6 +35,18 @@ def invoke_main(argv):
3535 return vcf_rdfizer .main ()
3636
3737
38+ def host_path_for_bind_mount (command , container_path : str ) -> Path :
39+ """Return a Docker bind-mount source without splitting Windows drive letters."""
40+ suffix = f":{ container_path } "
41+ for index , token in enumerate (command [:- 1 ]):
42+ if token != "-v" :
43+ continue
44+ mount = str (command [index + 1 ])
45+ if mount .endswith (suffix ):
46+ return Path (mount [: - len (suffix )])
47+ raise AssertionError (f"missing bind mount for { container_path } : { command } " )
48+
49+
3850class WrapperCrossPlatformUnitTests (VerboseTestCase ):
3951 def test_help_flag_prints_usage (self ):
4052 """CLI help succeeds and prints usage examples."""
@@ -99,6 +111,14 @@ def test_detect_compressed_format(self):
99111 self .assertEqual (vcf_rdfizer .detect_compressed_format (Path ("sample.nt.br" )), "brotli" )
100112 self .assertEqual (vcf_rdfizer .detect_compressed_format (Path ("sample.hdt" )), "hdt" )
101113
114+ def test_bind_mount_parser_preserves_windows_drive_letter (self ):
115+ """Validation mocks preserve Windows bind-mount source paths."""
116+ mount = r"C:\Users\runneradmin\AppData\Local\Temp\output:/data/out"
117+ self .assertEqual (
118+ str (host_path_for_bind_mount (["docker" , "run" , "-v" , mount ], "/data/out" )),
119+ r"C:\Users\runneradmin\AppData\Local\Temp\output" ,
120+ )
121+
102122 def test_compress_mode_runs_with_mocks (self ):
103123 """Compress mode succeeds with mocked Docker execution across OSes."""
104124 with tempfile .TemporaryDirectory () as td :
@@ -113,11 +133,7 @@ def fake_run(cmd, cwd=None, env=None):
113133 commands .append (cmd )
114134 rendered = str (cmd [- 1 ]) if cmd else ""
115135 if "validate_compression.py" in rendered :
116- out_mount = next (
117- Path (part .split (":" , 1 )[0 ])
118- for part in cmd
119- if isinstance (part , str ) and part .endswith (":/data/out" )
120- )
136+ out_mount = host_path_for_bind_mount (cmd , "/data/out" )
121137 result_match = re .search (
122138 r"--result-path\s+['\"]?(/data/out/[^\s'\";]+)" ,
123139 rendered ,
0 commit comments