pytest-mock-resources icon indicating copy to clipboard operation
pytest-mock-resources copied to clipboard

TBD: v3

Open DanCardin opened this issue 6 months ago • 2 comments

There are a number of certainly breaking changes that would be awesome to make that would make maintainence of the library easier. and a number of more generic large scale changes that may or may not be breaking but almost certainly should come along in tandem.

Breaking

  • default every image to :latest
    • we're currently defaulting to like 10 year old postgres/mysql versions which is absurd
    • drop support for sqlalchemy 1.3
    • drop python 3.7 support
    • Make it simpler to configure this in one line. Perhaps either a version= argument on the container fixture, or perhaps a configure_pmr_versions function.
  • sqlalchemy should be a completely optional dependency, only required when using fixture which require it.
  • most extras should be removed.
    • At least all the driver related ones should be because they're interchangeable within the dbapi. mongo/redis are weird because we're yielding implementation specific clients. redshift should probably be something like redshift-copy as an extra with better runtime errors if missed.
  • The config impl should be a simpler dataclass, not dynamic, and easier to impl new ones
  • Registration of resources should probably be done declaratively like register_resource(...), where we happen to bundle some.
  • drivername should be able to be configured per fixture, not just per config/container
  • create_<x>_fixture -> _fixture?
    • namely pmr_postgres_container = create_postgres_container_fixture() is kind of obnoxiously long. and required if you want to customize meaningful things about the container. ...or you need to manually define the config fixture yourself, which is even longer.

Big changes, not necessarily breaking

  • the tests need to be better organized and localized per fixture
  • It's currently impossible to test asyncpg/psycopg/psycopg2/aiopg in the same test environment, even though it's 4 different driver impls that ostensibly should all act identically and not clobber one another
  • likely a top level module __getattr__ would make it more straightforward to have fixture-specific dependency gates, such that we dont need to inline imports or have any weird compat interface layer. We'd dynamically import each fixture as it's referenced, and that would eagerly assert you need whatever required dependency; and test-time you'd check for an e.g. driver and gracefully alert about the lack of one.

DanCardin avatar Sep 11 '25 15:09 DanCardin