test.test_zoneinfo.test_zoneinfo.ExtensionBuiltTest.test_cache_location fails if `_zoneinfo` Cextension isn't built
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong Lib/test/test_zoneinfo/test_zoneinfo.py tại ExtensionBuiltTest.test_cache_location và kiểm tra get_modules(), đặc biệt là cách nó xử lý một module _zoneinfo không khả dụng. Xác minh các bài kiểm thử zoneinfo khi extension C tùy chọn chưa được build, bao gồm cả việc các bài kiểm thử trùng lặp của extension C có bị bỏ qua hay không. Được coi là hoàn tất khi test suite không còn giả định rằng _zoneinfo có thể được import và lỗi được báo cáo đã được giải quyết.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- testing-qa
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100