Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

feat: Support parsing pytest_plugins as a form of import.

Đang mở
#4,196 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
build-system

Hướng nghiên cứu

Start with the Gazelle plugin's dependency-scanning entry point and inspect how Python imports and existing gazelle:include_dep directives are handled. Extend the relevant parsing path to recognize valid string, list, and tuple pytest_plugins forms, then verify that each plugin import is added to deps using Gazelle's preferred label.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

feature request

Pytest does not utilize normal imports for fixtures, instead in your conftest.py or test file you can declare a pytest_plugins global, like so:

# To import foo.bar.baz and foo.bar.qux as pytest plugins that expose fixtures.
pytest_plugins = ["foo.bar.baz", "foo.bar.qux"]
# OR
pytest_plugins = ("foo.bar.baz", "foo.bar.qux")
# OR, to import only one item
pytest_plugins = "foo.bar.baz"
# No other formats are valid

This is, by pytest's standards, the intended way to import fixtures and extensions to the test engine, simply importing them is poorly supported and will not include transitive fixtures, nor properly rewrite asserts in the import.

pytest_plugins simply contains import paths and brings all fixtures and extensions in the import into scope.

Relevant Rules

Just the Gazelle plugin.

Description

This would be extending the Gazelle plugin to read pytest_plugins as a form of import, which should go in deps as normal.

Describe alternatives you've considered

Currently, we instead do this:


# gazelle:include_dep //tools/foo/tests:git_worktree,//tools/corporate_tool_utils/python/fixtures:put
pytest_plugins = ["tools.foo.tests.git_worktree", "tools.corporate_tool_utils.python.fixtures.put"]

This works fine, and is something we can lint for, but adds redundancy and can mismatch gazelle's preferred label for a dependency.

Ngôn ngữ chính
Starlark
Star
688
Fork
723
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
43

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bazel-contrib/rules_python

Tất cả issue của bazel-contrib/rules_python

Issue tương tự

Thêm issue về Build System

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.