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

Bug: Installation documentation is unclear

Open menzenski opened this issue 1 year ago • 1 comments

Describe the bug

I'm new to testcontainers and have been working on getting it set up to run MongoDB tests in Python.

I found https://testcontainers.com/guides/getting-started-with-testcontainers-for-python/ which instructs to install testcontainers-postgres, so I searched PyPi for testcontainers-mongo, found https://pypi.org/project/testcontainers-mongodb/, installed it (specifically with poetry add --group dev testcontainers-mongod, which installed v0.0.1rc1), and started using it to write tests.

I then ran into errors when trying to set the username, password, and dbname kwargs, which the documentation says I should be able to set:

class MongoDbContainer(image: str = 'mongo:latest', port: int = 27017, username: str | None = None, password: str | None = None, dbname: str | None = None, **kwargs)

In searching around for a resolution to this issue I realized that testcontainers in PyPi was published just last week with v4.4.0, while testcontainers-mongodb (and other packages like testcontainers-postgres) have not been published to PyPi since January 2023, and are only v0.0.1rc1.

I looked up this GitHub repository, saw the mongodb extra, and then removed the testcontainers-mongodb I had installed previously, and installed testcontainers[mongodb] instead.

This resolved my issue in that I am now able to set the username, password, and dbname kwargs that I wanted to. But I wanted to log an issue here to raise a request for some clarity around the best way to install testcontainers for Python.

I'm happy to contribute some draft documentation but may need some direction on where/how that should be done.

menzenski avatar Apr 23 '24 16:04 menzenski

opened a PR to fix this: https://github.com/testcontainers/tc-guide-getting-started-with-testcontainers-for-python/pull/3

alexanderankin avatar Apr 25 '24 12:04 alexanderankin

the pr was merged, if this comes up again, should probably be a separate issue

alexanderankin avatar Jul 01 '24 09:07 alexanderankin