GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(core): improper reading of .testcontainers.properties by laundry-96 · Pull Request #863 · testcontainers/testcontainers-python

Conversation

@laundry-96

@laundry-96 laundry-96 commented Aug 19, 2025 •
edited by alexanderankin
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

fix #864

The environment variables were not overridden from the .testcontainers.properties file for ryuk variables. This causes the properties file to never actually be used. This commit detects the environment variable, and if unspecified falls back to the properties file, and if not specified, defaults to false

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@laundry-96 laundry-96 mentioned this pull request Aug 19, 2025
Bug: .testcontainers.properties file not properly used #864
Closed
@alexanderankin alexanderankin changed the title Fix improper reading of .testcontainers.properties fix(core): improper reading of .testcontainers.properties Aug 19, 2025
@alexanderankin

alexanderankin commented Aug 19, 2025

Copy link
Copy Markdown
Member

see if you can make the tests pass? i can take a look to see if i can finish this pr when i am available

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@laundry-96
Fix improper reading of .testcontainers.properties
d18904c
The environment variables were not overridden from the .testcontainers.properties file for ryuk variables.
This causes the properties file to never actually be used.
This commit detects the environment variable, and if unspecified falls back to the properties file, and if not specifed, defaults to false
@laundry-96
laundry-96 force-pushed the patch-2 branch from 60f51ba to d18904c Compare August 19, 2025 18:53
@laundry-96

laundry-96 commented Aug 19, 2025

Copy link
Copy Markdown
Contributor Author

@alexanderankin I fixed it by adding a Optional[bool] defaulted to None, which allows an override for ryuk_disabled and ryuk_privileged programmatically.

Sorry for not reading the CONTRIBUTING.md. I didn't see it in the top level directory and didn't see the README.md 😅

I'm on a mac, so the test is set to skipped, but I disabled that and it seems to have passed. I can't be too sure until I see the tests here though.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@codecov

codecov Bot commented Aug 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.10345% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@b21e5e3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
core/testcontainers/core/config.py 93.10% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #863   +/-   ##
=======================================
  Coverage        ?   82.09%           
=======================================
  Files           ?       14           
  Lines           ?      916           
  Branches        ?      148           
=======================================
  Hits            ?      752           
  Misses          ?      128           
  Partials        ?       36           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@laundry-96
Added better tests for TestcontainersConfig class
e0362a1
Removed unused method get_bool_env, as it was replaced with _render_bool
Added more tests for proper test coverage for loading variables via testcontainers.properties file
@laundry-96
laundry-96 force-pushed the patch-2 branch from 116523d to e0362a1 Compare August 23, 2025 20:21
@laundry-96

laundry-96 commented Aug 23, 2025

Copy link
Copy Markdown
Contributor Author

@alexanderankin Can I get one more run please? I have added some extra test cases and caught some errors myself :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

laundry-96 and others added 2 commits August 23, 2025 22:27
@laundry-96
Merge branch 'main' into patch-2
e1ce158
@alexanderankin
Merge branch 'main' into patch-2
b98c304
@laundry-96

laundry-96 commented Aug 25, 2025

Copy link
Copy Markdown
Contributor Author

@alexanderankin It seems like the docs build failed due to a connection failure? Mind triggering again?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alexanderankin
alexanderankin approved these changes Aug 26, 2025
View reviewed changes
@alexanderankin

alexanderankin commented Aug 26, 2025

Copy link
Copy Markdown
Member

can you tldr what this code does? im on a work trip right now and just dont have time this week to look at this - i would merge otherwise

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@laundry-96

laundry-96 commented Aug 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

TLDR: Originally when running test containers, you can set variables inside of ~/.testcontainers.properties and it should be picked up to look at settings, if the corresponding environment variables are not set.

What was happening originally was that the ryuk_privileged and ryuk_disabled would read the environment, and if it wasn't set, it would default to False. And because the variable is set, it doesn't actually inherit the properties file.

Function causing this issue:

def get_bool_env(name: str) -> bool:
    """
    Get environment variable named `name` and convert it to bool.
    Defaults to False.
    """
    value = environ.get(name, "")
    return value.lower() in ("yes", "true", "t", "y", "1")

As you can see this would return either True or False.

What my change does, is bring this function into the class, and when attempting to access the disabled or privileged class value, it calculates it based on if it was set previously (via code, env, or properties file), and if not then checks the environment, then checks the properties file, then defaults to False

Also, I totally understand being busy! I just want to say thank you so much for providing this package from your own time and energy :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexanderankin
alexanderankin merged commit 350f246 into testcontainers:main Aug 27, 2025
@github-actions github-actions Bot mentioned this pull request Aug 27, 2025
chore(main): release testcontainers 4.13.0 #858
Merged
@laundry-96
laundry-96 deleted the patch-2 branch August 27, 2025 04:23
alexanderankin pushed a commit that referenced this pull request Sep 9, 2025
@github-actions
chore(main): release testcontainers 4.13.0 (#858)
504957b
🤖 I have created a release *beep* *boop*
---


##
[4.13.0](testcontainers-v4.12.0...testcontainers-v4.13.0)
(2025-08-27)


### Features

* **azurite:** Enhance connection string generation for network and
local access
([#859](#859))
([b21e5e3](b21e5e3))
* **core:** add enhanced wait strategies
([#855](#855))
([60d21f8](60d21f8))
* **core:** DockerCompose: support list of env_files
([#847](#847))
([fe206eb](fe206eb))


### Bug Fixes

* assert-in-get_container_host_ip-before-start
([#862](#862))
([fc4155e](fc4155e))
* **core:** improper reading of .testcontainers.properties
([#863](#863))
([350f246](350f246))
* **core:** Make TC_POOLING_INTERVAL/sleep_time a float
([#839](#839))
([a072f3f](a072f3f))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alexanderankin alexanderankin alexanderankin approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: .testcontainers.properties file not properly used

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@laundry-96 @alexanderankin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.