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

feat: Add support for moto as a fixture. #169

Closed DanCardin closed 1 year ago

DanCardin commented 1 year ago

I think this is primarily useful because responses and moto frequently encounter incompatibility such that you end up stuck on specific sets of versions of each, so that they play nicely together. Additionally, we've adopted custom responses/s3 fixtures that stub eachother in different ways to avoid issues.

By comparison, this is actually calling out to a real service and the faking out of AWS services like S3 end up happening elsewhere.

I'm also imagining that at some point, we can add on sqlalchemy fixtures' Rows-like functionality to declaratively state things you want to exist (i.e. buckets and files) in the context of your fixture, rather than needing per-test setup for such things.

codecov[bot] commented 1 year ago

Codecov Report

Merging #169 (ccaa4a1) into main (a28c490) will increase coverage by 2.63%. The diff coverage is 97.05%.

@@            Coverage Diff             @@
##             main     #169      +/-   ##
==========================================
+ Coverage   82.84%   85.48%   +2.63%     
==========================================
  Files          30       31       +1     
  Lines        1306     1378      +72     
  Branches      187      171      -16     
==========================================
+ Hits         1082     1178      +96     
+ Misses        183      162      -21     
+ Partials       41       38       -3     
Impacted Files Coverage Δ
src/pytest_mock_resources/fixture/credentials.py 100.00% <ø> (ø)
src/pytest_mock_resources/sqlalchemy.py 92.71% <90.90%> (ø)
src/pytest_mock_resources/fixture/moto.py 95.23% <95.23%> (ø)
src/pytest_mock_resources/__init__.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/container/moto.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/__init__.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/base.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/mongo.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/mysql.py 94.44% <100.00%> (ø)
src/pytest_mock_resources/fixture/postgresql.py 94.93% <100.00%> (ø)
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.