schireson / pytest-mock-resources

Pytest Fixtures that let you actually test against external resource (Postgres, Mongo, Redshift...) dependent code.
https://pytest-mock-resources.readthedocs.io/en/latest/quickstart.html
MIT License
179 stars 19 forks source link

fix: Yield config rather than the container. #196

Closed DanCardin closed 1 year ago

DanCardin commented 1 year ago

Yielding the container was just something we did originally, likely because it was "better" than yielding nothing. However we dont actually make use of the container itself anywhere downstream...because you cant! There's no way to guarantee that your test is the one that produces the container, which means most of the time, you'll end up getting None!

So instead, we should yield the config. This is actually useful, because the config value can be variable (think database name, or port) depending on your settings.

The practical application here is that a 3rd party resource is more easily able to "just make" calls to get_container and get something useful back (ft https://github.com/DanCardin/responsaas).

coveralls commented 1 year ago

Pull Request Test Coverage Report for Build 6305083270


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/pytest_mock_resources/cli.py 1 5 20.0%
<!-- Total: 2 6 33.33% -->
Files with Coverage Reduction New Missed Lines %
src/pytest_mock_resources/cli.py 2 25.37%
<!-- Total: 2 -->
Totals Coverage Status
Change from base Build 5649153478: -0.4%
Covered Lines: 1386
Relevant Lines: 1521

💛 - Coveralls