testcontainers / testcontainers/testcontainers-python
Feature: other ways to configure than the `.testcontainers.properties` in Home
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 2.3k
- Fork
- 386
- Merge trung bình
- 4 giờ 40 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
What are you trying to do?
I want to run my tests, which rely on Test Containers, on my CI. But I don't have the rights to edit the runner's profile home directory (read-only). So I would like to be able to provide a .testcontainers.properties elsewhere, or from environment variables.
This seems to be possible in the Java version, based on this docstring in the Python version :
Read the .testcontainers.properties for settings. (see the Java implementation for details)
Currently we only support the ~/.testcontainers.properties but may extend to per-project variables later.
:return: the merged properties from the sources.
But (see below) it relies on the Java classpath , and I don't think it would be relevant to use the pythonpath for that on Python's side.
So I am unsure how to proceed towards per-project (or arbitrarily-located) properties files.
But using environment variables should be straightforward.
Why should it be done this way?
Parity with Java implementation, and flexibility.
Other references:
From the Java documentation :
The configuration will be loaded from multiple locations. Properties are considered in the following order:
- Environment variables
- .testcontainers.properties in user's home folder. Example locations:
- Linux: /home/myuser/.testcontainers.properties
- Windows: C:/Users/myuser/.testcontainers.properties
- macOS: /Users/myuser/.testcontainers.properties
- testcontainers.properties on the classpath.
Note that when using environment variables, configuration property names should be set in upper case with underscore separators, preceded by TESTCONTAINERS_ - e.g. checks.disable becomes TESTCONTAINERS_CHECKS_DISABLE.
Next steps
Does it seem relevant to you ? Would you be interested I contribute a PR for it ?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu với testcontainers/core/config.py, đặc biệt là hành vi tải cấu hình được đề cập trong issue, và so sánh với thứ tự cấu hình của Java trong tài liệu được liên kết. Xác định cách các biến môi trường và một vị trí properties thay thế tương tác với các thiết lập trong tệp home. Công việc được xem là hoàn tất khi các nguồn cấu hình được hỗ trợ và thứ tự ưu tiên của chúng được ghi lại trong tài liệu và được kiểm thử.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- testing
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 38/100