diff --git a/.github/workflows/python-wheels.yml b/.github/workflows/python-wheels.yml index 5fd2e88e..582051d7 100644 --- a/.github/workflows/python-wheels.yml +++ b/.github/workflows/python-wheels.yml @@ -46,8 +46,11 @@ jobs: with: python-version: ${{ matrix.python }} + # The toolchain rust-toolchain.toml pins, as release.yml installs it: + # installing `stable` first and letting cargo fetch the pin conflicts on + # Windows runners (clippy's cargo-clippy.exe already present). - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + run: rustup show - name: Build the wheel on this platform run: | diff --git a/sdks/python/tests/test_vectors.py b/sdks/python/tests/test_vectors.py index f67f62ee..9c226d9d 100644 --- a/sdks/python/tests/test_vectors.py +++ b/sdks/python/tests/test_vectors.py @@ -14,7 +14,9 @@ from checkgate import CheckgateClient from checkgate._core import Engine -DOC = json.loads(VECTORS.read_text()) +# UTF-8 explicitly: the default is the locale encoding (cp1252 on Windows), +# which garbles the non-ASCII user key of the `unicode-user-key` case. +DOC = json.loads(VECTORS.read_text(encoding="utf-8")) CASES = DOC["cases"] OPTIONAL = ("rule_index", "rollout_bucket", "variant_index") diff --git a/sdks/python/tool/conformance_adapter.py b/sdks/python/tool/conformance_adapter.py index 446465f8..73a0cabb 100644 --- a/sdks/python/tool/conformance_adapter.py +++ b/sdks/python/tool/conformance_adapter.py @@ -47,6 +47,10 @@ def main() -> None: else: logging.getLogger("checkgate").setLevel(logging.CRITICAL + 1) client: Optional[CheckgateClient] = None + # The suite writes UTF-8; Python would otherwise decode the pipe with the + # locale encoding (cp1252 on Windows) and garble non-ASCII keys. + if hasattr(sys.stdin, "reconfigure"): + sys.stdin.reconfigure(encoding="utf-8") for line in sys.stdin: if not line.strip(): continue