testcontainers / testcontainers/testcontainers-python

Feature: other ways to configure than the `.testcontainers.properties` in Home

オープン
#904 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

🚀 enhancement
主要言語
Python
スター
2.3k
フォーク
386
平均マージ
4時間 40分
マージ済み PR(30日)
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:

  1. Environment variables
  2. .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
  1. 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 ?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

testcontainers/core/config.py から始め、特に issue で参照されている設定の読み込み動作を確認し、リンク先のドキュメントにある Java の設定順序と比較してください。環境変数と別の properties の場所が、home ファイルの設定とどのように相互作用するかを定義してください。サポートされる設定ソースとその優先順位が文書化され、テストでカバーされていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
testing
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。