gabrielcnr/pytest-datadir

UNC path breaks _win32_longpath()

Closed this issue · 4 comments

I have, due to DFS in my environment, tests running in a dfs path, which results in a UNC path (\\my.domain\dfs\some\path) being passed to copytree in shared_datadir(). This results in copytree failing with

OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '\\\\?\\\\\\my.domain\\dfs\\bla...

I traced this back to return '\\\\?\\' + os.path.normpath(path) in plugin._win32_longpath(), which afaict is not correct in case of a UNC path (see above UNC link). Then you need to insert an additional UNC\, so the prefix should be '\\\\?\\UNC\\' instead. UNC paths should be recognizable because they start with \\.

Thanks for raising this. Would you like to open a Pull Request with your proposed fix? It would be very welcome. :-)

I can try, could take a while though.

Apparently you identified the problem and even suggested what could possibly be the solution. We can help you getting the fix branch, the tests and the Pull Request if you need help with those. It would be a great contribution. ;-)

See #34 :-)