Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Testing: session scoped fixture for required model loading

Aperta
#1 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
testing-qa

Direzione di ricerca

Inizia con tests/load_models.py, tests/unload_models.py e conftest.py, poi esamina il workflow esistente tox -e load-test-models e le indicazioni collegate su fixture e marker di pytest. Implementa una gestione con ambito di sessione che rilevi i test lmstudio selezionati, tenga facoltativamente traccia dei relativi ID dei modelli e conservi i modelli richiesti; il lavoro è completato quando i test non richiedono più una configurazione separata per il caricamento dei modelli e -m "not lmstudio" ne eviti il caricamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
885
Fork
168
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di lmstudio-ai/lmstudio-python

Tutte le issue di lmstudio-ai/lmstudio-python

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.