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

Testing: session scoped fixture for required model loading

Đang mở
#1 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ 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 với tests/load_models.py, tests/unload_models.py và conftest.py, sau đó xem xét workflow tox -e load-test-models hiện có cùng với hướng dẫn được liên kết về pytest fixture và marker. Triển khai cơ chế xử lý theo phạm vi session để phát hiện các test lmstudio được chọn, tùy chọn theo dõi model ID của chúng và giữ lại các model bắt buộc; hoàn tất có nghĩa là các test không còn yêu cầu thiết lập riêng để tải model và -m "not lmstudio" tránh tải chúng.

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

Mô tả

The tests/load_models.py/tests/unload_models.py scripts that handle loading and unloading the models used by the test suite currently need to be invoked separately from the test suite execution.

While this approach works, it does mean that you can easily get spurious failures if you forget to run tox -e load-test-models before a local testing session.

We could potentially add a session scoped fixture in conftest.py to get pytest to natively handle ensuring that the required models have been loaded rather than needing to manage it externally: https://stackoverflow.com/questions/76608690/pytest-best-practice-to-setup-and-teardown-before-and-after-all-tests

To avoid pointlessly setting up the models when -m "not lmstudio" has been passed, the fixture should scan the loaded modules and ensure the models are only loaded if that mark is present on at least one selected test (see https://docs.pytest.org/en/stable/example/markers.html and https://docs.pytest.org/en/stable/example/special.html)

To make it even more efficient, the lmstudio marker could potentially be parameterised with the model IDs that a given test expects to already have loaded. For example:

@pytest.mark.lmstudio(models=[EXPECTED_LLM_ID, EXPECTED_EMBEDDING_ID])
def test_list_downloaded_models_async() -> None:
    ...

When scanning the selected test nodes, the fixture would keep track of the named models, and ensure those models were loaded before running any tests. To avoid problems with unexpected JIT model unloading during the test suite execution, the fixture would still mark models to remain loaded indefinitely.

Ngôn ngữ chính
Python
Star
885
Fork
168
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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 lmstudio-ai/lmstudio-python

Tất cả issue của lmstudio-ai/lmstudio-python

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.