python / python/cpython

test.test_zoneinfo.test_zoneinfo.ExtensionBuiltTest.test_cache_location fails if `_zoneinfo` Cextension isn't built

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

まだ誰も着手していません。

extension-modules tests type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

I was doing some testing to check that Python without optional C extensions remains functional, and I've noticed that the following test fails if _zoneinfo is not built:

======================================================================
FAIL: test_cache_location (test.test_zoneinfo.test_zoneinfo.ExtensionBuiltTest.test_cache_location)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mgorny/git/cpython/Lib/test/test_zoneinfo/test_zoneinfo.py", line 1931, in test_cache_location
    self.assertFalse(hasattr(c_zoneinfo.ZoneInfo, "_weak_cache"))
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: True is not false

FWICS the zoneinfo module tests unconditionally assume that zoneinfoimported with no "blocked" modules. While most of the time, this shouldn't matter, I suppose it would be cleaner to haveget_modules()returnNoneasc_moduleif_zoneinfo` is not importable.

I can try making a PR for this if you agree with this approach (and skipping the duplicate-then C extension tests).

CC @pganssle

CPython versions tested on:

3.13, CPython main branch

Operating systems tested on:

Linux

Linked PRs
  • gh-131104

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

Lib/test/test_zoneinfo/test_zoneinfo.py の ExtensionBuiltTest.test_cache_location から始めて、get_modules() を調べます。特に、利用できない _zoneinfo モジュールをどのように処理するかを確認してください。オプションの C 拡張がビルドされていない場合の zoneinfo テストを検証し、C 拡張の重複テストがスキップされるかどうかも確認してください。_zoneinfo がインポート可能であることをテストスイートが前提としなくなり、報告された失敗が解消されれば完了です。

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

評価

技術スタック
python
領域
testing-qa
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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