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

fix(modules): add py.typed marker to postgres module

Open oliverlambson opened this issue 5 months ago • 2 comments

It's already fully typed, just not marked as such

oliverlambson avatar Jul 23 '25 04:07 oliverlambson

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 79.52%. Comparing base (bb646e9) to head (eac2016).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #849      +/-   ##
==========================================
- Coverage   79.78%   79.52%   -0.26%     
==========================================
  Files          14       14              
  Lines        1182     1182              
  Branches      184      184              
==========================================
- Hits          943      940       -3     
- Misses        197      201       +4     
+ Partials       42       41       -1     

: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 Jul 23 '25 05:07 codecov[bot]

Not sure this is ready: poetry run mypy --config-file pyproject.toml modules/postgres/testcontainers/postgres/

modules/postgres/testcontainers/postgres/__init__.py:48: error: Function is missing a type annotation for one or more arguments  [no-untyped-def]
        def __init__(
        ^
modules/postgres/testcontainers/postgres/__init__.py:60: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")
[assignment]
            self.username: str = username or os.environ.get("POSTGRES_USER", "test")
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/postgres/testcontainers/postgres/__init__.py:61: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")
[assignment]
            self.password: str = password or os.environ.get("POSTGRES_PASSWORD", "test")
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/postgres/testcontainers/postgres/__init__.py:62: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")
[assignment]
            self.dbname: str = dbname or os.environ.get("POSTGRES_DB", "test")
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/postgres/testcontainers/postgres/__init__.py:73: error: Incompatible default for argument "driver" (default has type "object", argument has type
"Optional[str]")  [assignment]
        def get_connection_url(self, host: Optional[str] = None, driver: Optional[str] = _UNSET) -> str:
                                                                                         ^~~~~~
Found 5 errors in 1 file (checked 1 source file)

Maybe some stuff moved since this original commit?

Tranquility2 avatar Oct 07 '25 08:10 Tranquility2