testcontainers / testcontainers/testcontainers-python
Feature: other ways to configure than the `.testcontainers.properties` in Home
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 2.3k
- Fork
- 386
- Merge medio
- 4h 40m
- PR unite (30g)
- 1
Descrizione
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 ?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da testcontainers/core/config.py, in particolare dal comportamento di caricamento della configurazione citato nell’issue, e confrontalo con l’ordine di configurazione Java nella documentazione collegata. Definisci come le variabili d’ambiente e una posizione alternativa delle proprietà debbano interagire con le impostazioni del file home. Il lavoro è completo quando le origini di configurazione supportate e la loro precedenza sono documentate e coperte da test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- testing
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100