{"repo":"schireson/pytest-mock-resources","free":true,"listed":false,"github":"https://github.com/schireson/pytest-mock-resources","clone":"git clone https://github.com/schireson/pytest-mock-resources.git","description":"Pytest Fixtures that let you actually test against external resource (Postgres, Mongo, Redshift...) dependent code.","language":"Python","stars":205,"topics":["library","pytest","python","docker","postgres","mongodb","redshift","pytest-fixtures","tidepod","mongo"],"license":"MIT","category":"databases-storage","readme_excerpt":"Introduction Code which depends on external resources such a databases (postgres, redshift, etc) can be difficult to write automated tests for. Conventional wisdom might be to mock or stub out the actual database calls and assert that the code works correctly before/after the calls. However take the following, simple example: Sure, you can test serialize , but whether the actual query did the correct thing truly requires that you execute the query. The Pitch Having tests depend upon a real postgres instance running somewhere is a pain, very fragile, and prone to issues across machines and test failures. Therefore pytest-mock-resources (primarily) works by managing the lifecycle of docker containers and providing access to them inside your tests. As such, this package makes 2 primary assumptions: - You're using pytest (hopefully that's appropriate, given the package name) - For many resources, docker is required to be available and running (or accessible through remote docker). If you aren't familiar with Pytest Fixtures, you can read up on them in the Pytest documentation. In the above example, your test file could look something like Existing Resources (many more possible) - SQLite - Postgres - Redshift note Uses postgres under the hood, but the fixture tries to support as much redshift functionality as possible (including redshift's COPY / UNLOAD commands). - Mongo - Redis - MySQL - Moto Features General features include: - Support for \"actions\" which pre-populate the resou","default_branch":null,"files":null,"tree":[],"storefront":"/r/schireson","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/schireson/pytest-mock-resources/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}