testcontainers-python icon indicating copy to clipboard operation
testcontainers-python copied to clipboard

fix(core): Typing in docker_client

Open Tranquility2 opened this issue 1 year ago • 1 comments

Supports: https://github.com/testcontainers/testcontainers-python/issues/305 Related : https://github.com/testcontainers/testcontainers-python/pull/691 https://github.com/testcontainers/testcontainers-python/pull/692 #700

Based on #504, kudos @alexanderankin

poetry run mypy --config-file pyproject.toml core/testcontainers/core/docker_client.py 
Success: no issues found in 1 source file

Old

                    Error Summary                     
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ File Path                                 ┃ Errors ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ core/testcontainers/core/version.py       │ 12     │
│ core/testcontainers/core/docker_client.py │ 14     │
│ core/testcontainers/core/image.py         │ 17     │
│ core/testcontainers/core/waiting_utils.py │ 8      │
│ core/testcontainers/core/container.py     │ 20     │
│ core/tests/test_new_docker_api.py         │ 4      │
│ core/tests/test_docker_in_docker.py       │ 2      │
│ core/testcontainers/compose/compose.py    │ 22     │
│ core/testcontainers/compose/__init__.py   │ 2      │
│ core/tests/test_version.py                │ 2      │
│ core/tests/test_ryuk.py                   │ 2      │
│ core/tests/test_registry.py               │ 1      │
│ core/tests/test_image.py                  │ 3      │
│ core/tests/test_compose.py                │ 7      │
└───────────────────────────────────────────┴────────┘
Found 116 errors in 14 files.

New

                    Error Summary                     
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ File Path                                 ┃ Errors ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ core/testcontainers/core/version.py       │ 12     │
│ core/testcontainers/core/network.py       │ 3      │
│ core/testcontainers/core/image.py         │ 17     │
│ core/testcontainers/core/waiting_utils.py │ 8      │
│ core/testcontainers/core/container.py     │ 19     │
│ core/tests/test_new_docker_api.py         │ 4      │
│ core/tests/test_docker_in_docker.py       │ 2      │
│ core/testcontainers/compose/compose.py    │ 22     │
│ core/testcontainers/compose/__init__.py   │ 2      │
│ core/tests/test_version.py                │ 2      │
│ core/tests/test_ryuk.py                   │ 2      │
│ core/tests/test_registry.py               │ 1      │
│ core/tests/test_image.py                  │ 3      │
│ core/tests/test_compose.py                │ 7      │
└───────────────────────────────────────────┴────────┘
Found 104 errors in 14 files.

Tranquility2 avatar Sep 16 '24 05:09 Tranquility2

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Please upload report for BASE (main@e9e40f9). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #702   +/-   ##
=======================================
  Coverage        ?   84.97%           
=======================================
  Files           ?       12           
  Lines           ?      679           
  Branches        ?      106           
=======================================
  Hits            ?      577           
  Misses          ?       79           
  Partials        ?       23           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Sep 16 '24 06:09 codecov[bot]

Please note:

core/testcontainers/core/config.py:46: error: X | Y syntax for unions requires Python 3.10  [syntax]
        connection_mode: str | None = environ.get("TESTCONTAINERS_CONNECTION_MODE")

Found when rebasing and updated to support 3.9 (I'm not aware of deprecating 3.9 in tc-python, feel free to update)

Tranquility2 avatar Nov 16 '24 09:11 Tranquility2

@alexanderankin @kiview can you please rerun this? (I assume this was an issue with the docker registry)

Tranquility2 avatar Dec 14 '24 18:12 Tranquility2

@CarliJoy apricate you taking the time to comment :) I'll be happy to fix and update as suggested. I assume/hope https://github.com/testcontainers/testcontainers-python/pull/700 & https://github.com/testcontainers/testcontainers-python/pull/701 will go in first so I'll know we are really rolling with this track.

Tranquility2 avatar Mar 08 '25 22:03 Tranquility2

@CarliJoy Updated with all of the Fixes

Tranquility2 avatar Mar 15 '25 10:03 Tranquility2