testcontainers / testcontainers/testcontainers-python
Feature: other ways to configure than the `.testcontainers.properties` in Home
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 2.3k
- Forks
- 386
- Ø Merge
- 4 Std. 40 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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 ?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit testcontainers/core/config.py, insbesondere mit dem im Issue referenzierten Verhalten beim Laden der Konfiguration, und vergleiche es mit der Java-Konfigurationsreihenfolge in der verlinkten Dokumentation. Lege fest, wie Umgebungsvariablen und ein alternativer Speicherort für Properties mit den Einstellungen aus der Home-Datei interagieren sollen. Als abgeschlossen gilt die Aufgabe, wenn die unterstützten Konfigurationsquellen und ihre Priorität dokumentiert und durch Tests abgedeckt sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- testing
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 38/100