Skip to content

fix(tests): Fix Windows test failures related to click 8.2 encoding issues#1560

Open
BillionClaw wants to merge 1 commit intodbcli:mainfrom
BillionClaw:clawoss/fix/windows-click-encoding
Open

fix(tests): Fix Windows test failures related to click 8.2 encoding issues#1560
BillionClaw wants to merge 1 commit intodbcli:mainfrom
BillionClaw:clawoss/fix/windows-click-encoding

Conversation

@BillionClaw
Copy link

Description

This PR fixes Windows test failures related to click 8.2 encoding issues.

Problem

Windows uses CP1252 encoding by default, which cannot handle Unicode characters output by click.echo(). This causes test failures on Windows when using click 8.2+ with error messages like:

UnicodeEncodeError: 'charmap' codec can't encode character '\u2023' in position X: character maps to <undefined>

Solution

Set PYTHONIOENCODING=utf-8 environment variable to ensure proper Unicode handling:

  1. tests/conftest.py: Set PYTHONIOENCODING=utf-8 at module level for Windows platform during test collection
  2. tox.ini: Set PYTHONIOENCODING=utf-8 via setenv for all test environments

Changes

  • Added Windows encoding fix in tests/conftest.py
  • Added PYTHONIOENCODING=utf-8 to tox.ini testenv configurations

Testing

  • Verified tests pass locally
  • Changes are minimal and focused on fixing Windows encoding issues

Fixes encoding issues that cause UnicodeEncodeError on Windows when tests output Unicode characters through click.echo().

…ssues

Windows uses CP1252 encoding by default, which cannot handle Unicode
characters output by click.echo(). This causes test failures on Windows
when using click 8.2+.

This fix sets PYTHONIOENCODING=utf-8 in:
- tests/conftest.py: Set at module level for Windows platform
- tox.ini: Set via setenv for all test environments

Fixes encoding issues that cause UnicodeEncodeError on Windows when
tests output Unicode characters through click.echo().
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

Successfully merging this pull request may close these issues.

1 participant