Skip to content

Windows test collection fails with UnicodeDecodeError in provider dependency refresh #73525

Description

@KristoferFangrat

Under which category would you file this issue?

Airflow Core

Apache Airflow version

main checkout at commit 49674b7

What happened and how to reproduce it?

On Windows, running a focused provider test can fail during pytest collection before any tests are collected. The tests_common.pytest_plugin invokes scripts/ci/prek/update_providers_dependencies.py, which reads UTF-8 project files with Path.read_text() without an explicit encoding. With the Windows cp1252 locale this raises UnicodeDecodeError.

Observed error:

UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position ...
...
subprocess.CalledProcessError: ... update_providers_dependencies.py

The failure occurs before the test file runs.

What you think should happen instead?

Airflow's provider dependency refresh and pytest collection should read repository files as UTF-8 explicitly and work on Windows without requiring a locale override.

Operating System

Windows 11

Deployment

None

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

Airflow main checkout (2026-09-22), Python 3.11, pytest 9.1.1

Official Helm Chart version

Not Applicable

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

No response

Anything else?

Reproduction on Windows with a non-UTF-8 default locale:

set PYTHONUTF8=0
set PYTHONPATH=devel-common/src;providers/google/src
.venv\Scripts\python.exe -m pytest providers/google/tests/unit/google/cloud/operators/test_stackdriver.py -q

Pytest collection fails before tests run. Setting PYTHONUTF8=1 allows collection to progress, which points to locale-dependent file reads.

Relevant files:

  • devel-common/src/tests_common/pytest_plugin.py
  • scripts/ci/prek/update_providers_dependencies.py

Both contain repository-file reads without an explicit UTF-8 encoding. GitHub search found no existing Airflow issue for this exact Windows/cp1252 failure.

Are you willing to submit a PR?

  • Yes

Code of Conduct:

  • I agree to follow the project's Code of Conduct.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions