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

pytest-bdd steps only support fixture using @pytest.fixture, but do not support fixture generated by pytest_generate_tests function

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

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
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
testing-qa

Hướng nghiên cứu

Bắt đầu bằng cách chạy ví dụ @given được hiển thị với normal_fixture và generated_fixture, sau đó kiểm tra cách pytest-bdd phân giải các đối số của step cùng với pytest_generate_tests trong conftest.py. Hoàn tất khi ví dụ được collect và chạy với các giá trị 1, 2 và 3 của generated_fixture mà không gặp lỗi “fixture not found”.

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

Mô tả

@given("test generated fixture")
def test_generated_fixture(normal_fixture, generated_fixture):
print(fixture)
print(generated_fixture)
return 1

@pytest.fixture
def normal_fixture():
return 1

defined pytest_generated_tests in conftest.py

def pytest_generate_tests(metafunc):
if "generated_fixture" in metafunc.fixturenames:
metafunc.parametrize("generated_fixture", [1, 2, 3])

will result in error
E fixture 'generated_fixture' not found

Ngôn ngữ chính
Python
Star
1.5k
Fork
251
Merge trung bình
3 giờ 41 phút
Pull request đã merge (30 ngày)
4

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 pytest-dev/pytest-bdd

Tất cả issue của pytest-dev/pytest-bdd

Issue tương tự

Thêm issue về Python

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.