diff --git a/tests/conftest.py b/tests/conftest.py index e50f1fe07..449ace453 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import os +import sys import pytest from utils import ( POSTGRES_HOST, @@ -13,6 +14,13 @@ import pgcli.pgexecute +# Fix for Windows encoding issues with click 8.2+ +@pytest.fixture(autouse=True, scope="session") +def fix_windows_encoding(): + if sys.platform == "win32": + os.environ["PYTHONIOENCODING"] = "utf-8" + + @pytest.fixture(scope="function") def connection(): create_db("_test_db") diff --git a/tox.ini b/tox.ini index 1b8ea025a..5cd31b516 100644 --- a/tox.ini +++ b/tox.ini @@ -4,6 +4,7 @@ envlist = py [testenv] skip_install = true deps = uv +setenv = PYTHONIOENCODING=utf-8 commands = uv pip install -e .[dev] coverage run -m pytest -v tests coverage report -m