You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
The test times out waiting for the "stopped" event:
File "C:\git\ptvsd\tests\func\test_breakpoints.py", line 56, in test_path_with_unicode
hit = session.wait_for_thread_stopped('breakpoint')
When pytest-xdist is used (i.e. by default, unless running with -n0 - so also on all automated runs), the error message is different:
2019-01-26T01:52:18.9629438Z Traceback (most recent call last):
2019-01-26T01:52:18.9629644Z File "d:\a\1\s\.tox\py35\lib\site-packages\pytest_timeout.py", line 344, in timeout_timer
2019-01-26T01:52:18.9629820Z write(stdout)
2019-01-26T01:52:18.9630019Z File "d:\a\1\s\.tox\py35\lib\site-packages\pytest_timeout.py", line 397, in write
2019-01-26T01:52:18.9630193Z stream.write(text)
2019-01-26T01:52:18.9630546Z File "d:\a\1\s\.tox\py35\lib\encodings\cp1252.py", line 19, in encode
2019-01-26T01:52:18.9630726Z return codecs.charmap_encode(input,self.errors,encoding_table)[0]
2019-01-26T01:52:18.9630927Z UnicodeEncodeError: 'charmap' codec can't encode characters in position 290-293: character maps to <undefined>
This is due to a bug in pytest-xdist when handling captured test output with non-Unicode characters. The underlying root cause is per above.
The text was updated successfully, but these errors were encountered:
The root cause here is the way Python pre-3.6 handles script filenames internally - while __file__ of a module and co_filename of a code object are Unicode in 3.x, the string seems to pass through a decoding/encoding process at some point, which uses sys.getfilesystemencoding() - which on Windows corresponds to "ANSI" encoding for the current locale. As a result, if any non-ASCII characters cannot be represented in that encoding, the code object ends up with co_filename == '<encoding error>'. Which, of course, doesn't match the proper file name in the breakpoint. In 3.6+, this changed due to PEP 529, which is why this issue no longer exists there (unless legacy mode is enabled).
So far as I can tell, the only way to mitigate this is to force a different locale that can accommodate the characters in the test. But it doesn't look like that can be changed easily just for the test run, and otherwise we generally can't assume what the locale is on the system which runs the test. So, we'll just have to disable this test for 3.5, and generally recommend that people who want to use Unicode paths in Python on Windows should migrate to 3.6+.
int19h
added a commit
to int19h/ptvsd
that referenced
this issue
Jan 31, 2019
Manifests in
tests/func/test_breakpoints.py::test_path_with_unicode[file-attach_socket_import]
on Python 3.5:The test times out waiting for the "stopped" event:
When pytest-xdist is used (i.e. by default, unless running with
-n0
- so also on all automated runs), the error message is different:This is due to a bug in pytest-xdist when handling captured test output with non-Unicode characters. The underlying root cause is per above.
The text was updated successfully, but these errors were encountered: