Skip to content

Bug: Connection mode override environment variable is not honored #774

Closed

Description

@mschmitzer

Describe the bug

The testcontainers.core.config module defines a get_user_overridden_connection_mode function that reads the TESTCONTAINERS_CONNECTION_MODE environment variable. This looks as though it should be used to initialize the connection_mode_override member of the testcontainers_config object, but is actually unused.

I guess this might be intentional, but it would seem useful to be able to easily control the connection mode from the environment.

To Reproduce

import os
os.environ["TESTCONTAINERS_CONNECTION_MODE"] = "bridge_ip"
import testcontainers.core.config as config
assert config.testcontainers_config.connection_mode_override == config.ConnectionMode.bridge_ip

Runtime environment

$ uname -a
Linux *** 6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Sat Jan 11 00:06:25 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 3.9.2
$ pip freeze
certifi==2025.1.31
charset-normalizer==3.4.1
docker==7.1.0
idna==3.10
python-dotenv==1.0.1
requests==2.32.3
testcontainers==4.9.1
typing_extensions==4.12.2
urllib3==2.3.0
wrapt==1.17.2

Activity

  1. alexanderankin commented on Feb 17, 2025

    @alexanderankin
    Member

    this one is pretty silly! fix incoming as soon as someone approves my PR

  2. added a commit that references this issue on Apr 4, 2025
    ab2a1ab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions