testcontainers / testcontainers/testcontainers-python
Feature: other ways to configure than the `.testcontainers.properties` in Home
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 2.3k
- 派生
- 386
- 平均合并
- 4 小时 40 分钟
- 30 天内合并 PR
- 1
描述
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 ?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 testcontainers/core/config.py 开始,重点查看 issue 中提到的配置加载行为,并将其与链接文档中的 Java 配置顺序进行比较。明确环境变量和备用 properties 位置应如何与 home 文件中的设置交互。完成的标准是:已记录受支持的配置来源及其优先级,并通过测试覆盖这些行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- testing
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100