curl/trurl

Test fails on windows because of different null device name

krishean opened this issue · 4 comments

On windows test 114 ( trurl.exe -f /dev/null --json ) fails because the null device is called just "nul"

This could potentially be fixed by adding:

# change the null device name to "nul" if running on windows
if sys.platform == "win32" and "/dev/null" in self.arguments:
    self.arguments = ["nul" if arg == "/dev/null" else arg for arg in self.arguments]

below line 52 in test.py:

trurl/test.py

Line 52 in c1bd6b8

There may be a better way to do this, if so I'm open to suggestions, otherwise I can submit a pull request.

Could do something like:

if os.devnull != "/dev/null" and "/dev/null" in self.arguments:
    self.arguments = [os.devnull if arg == "/dev/null" else arg for arg in self.arguments]

to remove the explicit win32 check, but it's roughly the same in either case, macos uses /dev/null as well, windows is the only os that uses a different device name as far as I'm aware, even cygwin and msys2 have code to allow /dev/null to work on windows.

We could just create a new empty file in testfiles/ and use that instead of /dev/null

I wouldn't have thought to do it that way, a much simpler way to fix it.