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

tests: discuss removing dotenv environment mutation during TTS collection

Aperta
#8,230 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Read tests/test_tts.py, especially the module level load_dotenv(override=True) call and the collection time PLUGIN filtering. First reproduce the overwrite in a subprocess using a temporary .env and dummy values, then determine how provider selection and credentials should be prepared explicitly for TTS tests. Done means collect only preserves preexisting environment values while intentional TTS configuration still works.

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

Descrizione

Problem

While auditing test import-time side effects after #8134, I noticed that tests/test_tts.py calls load_dotenv(override=True) at module scope.

At main commit 2a1c02d17cb90244dc27a8161ff4825707430665, this is at line 56:
https://github.com/livekit/agents/blob/2a1c02d17cb90244dc27a8161ff4825707430665/tests/test_tts.py#L56

Importing the module during collection can therefore replace pre-existing process environment values with values from a discovered .env, even when no test executes. Later in the same module, the PLUGIN environment variable controls parameter filtering, so preserving intentional collection-time configuration needs care.

This module already has the tts category marker. Category filtering protects --unit runs; this report concerns collection when the TTS module is selected or pytest runs without a category filter. I am not claiming the current unit gate imports it or that this causes a model download.

Verification

I parsed the test module, extracted its module-level load_dotenv(override=True) expression, and executed that expression using the real python-dotenv loader with an explicit temporary .env path. With a dummy variable initially set to from-shell and the temporary file setting it to from-dotenv, the expression overwrote the original value. No real credentials were used or inspected.

This is an isolated verification of the statement's overwrite behavior, not a full pytest collection reproduction. A regression test should exercise collection in a subprocess with a temporary .env and dummy values.

Proposed scope for discussion

Would you welcome a small follow-up that removes implicit environment mutation from importing this module and makes dotenv preparation explicit for TTS test execution?

The implementation would preserve intentional provider selection and credential setup, and verify that collect-only does not overwrite dummy environment values. Since PLUGIN is read during collection, simply moving everything into an autouse fixture would be insufficient; I would agree on the intended configuration path before implementing it.

No production behavior, changelogs, package manifests, or version files would change. I have not started an implementation and would appreciate guidance on the preferred scope.

Lingua principale
Python
Stelle
14.6k
Fork
3.9k
Merge medio
2g 6h
PR unite (30g)
227

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 livekit/agents

Tutte le issue di livekit/agents

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.