Skip to content

Remove class-level variables from containers. - #296

Merged
tillahoffmann merged 34 commits into
testcontainers:masterfrom
tillahoffmann:pythonic
Apr 11, 2023
Merged

Remove class-level variables from containers.#296
tillahoffmann merged 34 commits into
testcontainers:masterfrom
tillahoffmann:pythonic

Conversation

@tillahoffmann

@tillahoffmanntillahoffmann commented Jan 7, 2023

Copy link
Copy Markdown
Contributor

Several of the containers currently load environment variables at import time. Consequently, if we create a container, its configuration may not match the current environment variables. Containers also overwrite class variables with instance variables of the same name which can cause confusion.

This PR

  • removes all class-level variables and loads environment variables at the time the container is created.
  • unifies the container API by renaming user to username and port_to_expose to port where applicable such that all containers have the same parameter names. The motivation behind renaming port_to_expose is that some containers have multiple different ports (cf. Clickhouse container exposing ports setup is strange #257 and Add azurite module #234). [specific]_port_to_expose is just a bit long.

This will break a bunch of stuff, but I'm planning to squeeze a lot of this cleanup into the next major release.

Comment threadcore/testcontainers/core/generic.py Outdated
Comment threadcore/testcontainers/core/utils.py Outdated
Comment threadneo4j/testcontainers/neo4j/__init__.py Outdated
@pffijt
pffijt self-requested a review February 23, 2023 11:36
@pffijt

pffijt commented Feb 23, 2023

Copy link
Copy Markdown
Contributor

We should fix the minor inconsistencies then this pr should be ready for merge.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@tillahoffmann@pffijt@ImFlog