Skip to content

Make the test suite deterministic on Windows and proxied environments #181

Description

@abhinavkr26104

Description

The unit suite is not portable to a supported Windows checkout. On Windows with normal Git CRLF conversion and common proxy environment variables, four otherwise-local tests fail.

Reproduction

On Windows/Python 3.12 after installing the dev dependencies:

python -m pytest -q -n 0 -k "not aiohttp"

Observed failures:

  1. tests/test_transform.py:424 (sync and async): tests/sample_file.txt is checked out with CRLF, producing SGVsbG8sIHdvcmxkIQ0K; the assertion hard-codes LF bytes (SGVsbG8sIHdvcmxkIQo=).
  2. tests/test_client.py:996 and tests/test_client.py:1936: the proxy tests expect one mount after setting HTTP_PROXY, but inherited NO_PROXY/proxy environment state can cause httpx to produce zero matching mounts.

Result from this audit: 4 failed, 1072 passed, 2 skipped after excluding the separately parameterized aiohttp cases. The remaining suite passes.

Expected behavior

Tests should pass on every OS advertised in pyproject.toml (Operating System :: Microsoft :: Windows) and should isolate themselves from host proxy variables and line-ending conversion.

Suggested fixes:

  • Make sample_file.txt binary-stable via .gitattributes, or derive the expected base64 from the file bytes rather than a hard-coded newline convention.
  • Clear all relevant proxy/no-proxy environment variables in the proxy tests before setting the values under test.
  • Add a Windows CI job, at least for the core unit suite.

Why it matters

Windows contributors currently cannot get a clean test run from an unmodified checkout, and the Linux-only CI matrix cannot catch these regressions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions