python-cmake/pytest-cmake

Output generated during test discovery is mangled by pytest-cmake

Closed this issue · 3 comments

I had a very hard time troubleshooting #22 because output from test discovery is mangled by pytest-cmake==0.5.1 on Windows.

Specifically // and ; sometimes disappear from the build output, which made it really hard to figure out what is going on in #22.

As previously commented on #22, I don't think the "mangling" of environment variables is a bug. But please give me more details about your issue if you disagree.

Specifically // and ; sometimes disappear from the build output, which made it really hard to figure out what is going on in #22.

Your issue title mentions the mangled test discovery, but you are talking about the build output. So I am not sure which problem you are referring to. Also, the CMake script itself doesn't alter the test discovery output, but Pytest uses the pathlib module, which handles the conversion between Unix and Windows paths:

>>> pathlib.Path("c:\\path\\to\\file")
WindowsPath('c:/path/to/file')

>>> pathlib.Path("c:/path/to/file")
WindowsPath('c:/path/to/file')

>>> str(pathlib.Path("c:/path/to/file"))
'c:\\path\\to\\file'

Please provide more details so I can investigate this further. Path handling on Windows can be messy, and I want to make sure I'm not missing anything important.

Also, the CMake script itself doesn't alter the test discovery output

This is not something I can explain.
But when test discovery was failing (due to PATH being wrong) the output from CMake build contained lines that were printed to stdout by Python code, except // and ; characters, which were removed.

Specifically I was printing in Python code the PATH variable (which had \\; in many places - those 3 literal characters; those slashes are not escapes here), and the build output contained the PATH without those characters. When I was saving PATH to a file those characters were there intact.

I will close this issue, as I can no longer reproduce it. Thank you for looking into it.