Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing on Windows #56

Open
jaraco opened this issue Feb 19, 2024 · 2 comments
Open

Tests failing on Windows #56

jaraco opened this issue Feb 19, 2024 · 2 comments

Comments

@jaraco
Copy link
Collaborator

jaraco commented Feb 19, 2024

Several of the tests are failing on Windows, seemingly due to encoding issues.

@jaraco
Copy link
Collaborator Author

jaraco commented Feb 19, 2024

Two of the issues manifest thus:

___________ TestUnicodeReader.test_bytes_encoding_detection_windows ___________

self = <tests.test_io.TestUnicodeReader object at 0x0000017C24A398E0>

    def test_bytes_encoding_detection_windows(self):
        """Test for detecting the encoding of a windows-1252 bytes file"""
        filepath = p.join(io.DATA_DIR, "windows1252.csv")
        records = io.read_csv(filepath, mode="rb")
        assert self.row1 == next(records)
>       assert self.row4 == next(records)
E       AssertionError: assert {'a': '4', 'b': '5', 'c': 'ñ'} == {'a': '4', 'b': '5', 'c': '–'}
E         
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'c': 'ñ'} != {'c': '–'}
E         Use -v to get more diff

tests\test_io.py:179: AssertionError
---------------------------- Captured stdout call -----------------------------
detected encoding: Windows-1252
Reopening <_io.BufferedReader name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv'> with encoding: Windows-1252
---------------------------- Captured stderr call -----------------------------
<_io.BufferedReader name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv'> was opened in bytes mode but isn't being written to
------------------------------ Captured log call ------------------------------
WARNING  meza.io.base:io.py:483 <_io.BufferedReader name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv'> was opened in bytes mode but isn't being written to
DEBUG    meza.io.base:io.py:415 detected encoding: Windows-1252
DEBUG    meza.io.base:io.py:446 Reopening <_io.BufferedReader name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv'> with encoding: Windows-1252
___________ TestUnicodeReader.test_wrong_encoding_detection_windows ___________

self = <tests.test_io.TestUnicodeReader object at 0x0000017C24A39C70>

    def test_wrong_encoding_detection_windows(self):
        """Test for detecting the encoding of a windows file opened in ascii"""
        filepath = p.join(io.DATA_DIR, "windows1252.csv")
        records = io.read_csv(filepath, encoding="ascii")
        assert self.row1 == next(records)
>       assert self.row4 == next(records)
E       AssertionError: assert {'a': '4', 'b': '5', 'c': 'ñ'} == {'a': '4', 'b': '5', 'c': '–'}
E         
E         Omitting 2 identical items, use -vv to show
E         Differing items:
E         {'c': 'ñ'} != {'c': '–'}
E         Use -v to get more diff

tests\test_io.py:186: AssertionError
---------------------------- Captured stdout call -----------------------------
detected encoding: Windows-1252
Reopening <_io.TextIOWrapper name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv' mode='r' encoding='ascii'> with encoding: Windows-1252
---------------------------- Captured stderr call -----------------------------
'ascii' codec can't decode byte 0x96 in position 16: ordinal not in range(128)
<_io.TextIOWrapper name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv' mode='r' encoding='ascii'> was opened with the wrong encoding (ascii)
Incorrectly encoded file, reopening with bytes to detect encoding
------------------------------ Captured log call ------------------------------
WARNING  meza.io.base:io.py:483 'ascii' codec can't decode byte 0x96 in position 16: ordinal not in range(128)
WARNING  meza.io.base:io.py:392 <_io.TextIOWrapper name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv' mode='r' encoding='ascii'> was opened with the wrong encoding (ascii)
WARNING  meza.io.base:io.py:407 Incorrectly encoded file, reopening with bytes to detect encoding
DEBUG    meza.io.base:io.py:415 detected encoding: Windows-1252
DEBUG    meza.io.base:io.py:446 Reopening <_io.TextIOWrapper name='D:\\a\\meza\\meza\\data\\test\\windows1252.csv' mode='r' encoding='ascii'> with encoding: Windows-1252

It appears as if the failure is a coding mistake - the test data doesn't match the test expectations (there's no ñ in windows1252.csv).

jaraco added a commit to jaraco/meza that referenced this issue Feb 19, 2024
@jaraco
Copy link
Collaborator Author

jaraco commented Feb 19, 2024

See also 09ffd67 where doctests, once enabled, started failing on Windows as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant