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
183 stars 19 forks source link

Hardcoded config for MySQL #100

Closed bitphage closed 3 years ago

bitphage commented 3 years ago

container/mysql.py has a hardcoded config dict and it's being used immediately by creating _mysql_container = ... object. This makes impossible to override these config settings, for example docker image.

DanCardin commented 3 years ago

Yes, this is definitely an issue. In https://github.com/schireson/pytest-mock-resources/issues/79 I described some options. Looks like I even wrote a POC in https://github.com/schireson/pytest-mock-resources/pull/81 (for postgres, but easy to extend from there).

I'll see if i can find some time over the weekend or something to push 81 over the finish line, which should make extending the method for mysql easy to extend in the same way

DanCardin commented 3 years ago

The above PR should have exposed https://pytest-mock-resources.readthedocs.io/en/latest/api.html#fixture-config which should enable you to customize things like the targeted docker image. Should be released in 1.5.0

This feature, in particular, is difficult to test in CI due to the kind of fixed nature of its docker companion image stuff, so happy to keep contributing fixes if you run into issues we didn't encounter.

Closing for now, unless/until you come back with issues