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

tests: discuss removing dotenv environment mutation during TTS collection

Đang mở
#8,230 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ó
4/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
testing

Hướng nghiên cứu

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.

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

Mô tả

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.

Ngôn ngữ chính
Python
Star
14.6k
Fork
3.9k
Merge trung bình
2 ngày 7 giờ
Pull request đã merge (30 ngày)
228

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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

Tất cả issue của livekit/agents

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.