[BUG] crewai-devtools: the test suite fails on Windows because file IO has no encoding

オープン
#9,230 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@lxcxjxhx がすでに取り組んでいます。

2026年11月7日 から。

  • #9231 @lxcxjxhx による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
cli, testing

調査の方向性

Start with the text-mode file calls in lib/devtools/src/crewai_devtools/cli.py and docs_check.py, then review the text reads and writes in lib/devtools/tests/*.py. Run pytest tests -q from lib/devtools on Windows to reproduce the failures. Done means the suite passes and text-mode calls use UTF-8; the issue reports 105 passing tests after the change. An open linked pull request already covers this work.

索引モデルが issue の本文から書いたものです。

説明

[BUG] crewai-devtools: the test suite fails on Windows because file IO has no encoding

What

crewai-devtools reads and writes its own repository files — pyproject.toml, CHANGELOG.md, AGENTS.md, docs pages — with text-mode open() / Path.read_text() / Path.write_text() and no encoding, so the platform default applies: UTF-8 on Linux/macOS and the ANSI code page on Windows.

On Windows the packaged test suite therefore fails out of the box:

$ cd lib/devtools && pytest tests -q
FAILED tests/test_toml_updates.py::TestUpdatePyprojectDependencies::test_default_packages_cover_all_workspace_members
FAILED tests/test_toml_updates.py::test_crewai_pins_every_workspace_sibling_to_its_own_version
2 failed, 103 passed

tests\test_toml_updates.py:437: in test_default_packages_cover_all_workspace_members
    root_pyproject = (workspace_root / "pyproject.toml").read_text()
E   UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 19647: illegal multibyte sequence

tests\test_toml_updates.py:608: in _crewai_version
    match = re.search(r'__version__\s*=\s*"([^"]+)"', init.read_text())
E   UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 ...

0x94 is part of a UTF-8 sequence for a typographic quote — the repository's own files contain them (em dashes and curly quotes in the docs and in cli.py's help strings).

Why it matters beyond the tests

The same pattern is in the CLI itself (23 sites in cli.py and docs_check.py): bump-version, tag, release and docs-check all read and rewrite those files. On Windows they hit the same decode error, and where a file does decode, the rewrite is emitted in the ANSI code page — turning a UTF-8 repository file into one that Linux/macOS, git and CI read as mojibake.

Suggested fix

Add encoding="utf-8" to the text-mode calls in lib/devtools/src/crewai_devtools/{cli.py,docs_check.py} and in lib/devtools/tests/*.py (57 call sites). No behaviour change on POSIX, where UTF-8 is already the default; binary opens ("rb"/"wb") are untouched.

Verified on Windows 11 / CPython 3.13 with the package installed editable from lib/devtools:

$ pytest tests -q        # before
2 failed, 103 passed
$ pytest tests -q        # after the change
105 passed

ruff check on the touched files reports the same findings as HEAD (verified with git stash), so nothing new is introduced.

I will send the patch as the PR for this issue unless you would rather scope it to the tests only.

主要言語
Python
スター
60.6k
フォーク
9.1k
平均マージ
1日 9時間
マージ済み PR(30日)
218

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

crewAIInc/crewAI のほかの issue

crewAIInc/crewAI の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。