简体   繁体   中英

pytest-django and conservative db access

I know that pytest-django takes a 'conservative' approach to database access: https://pytest-django.readthedocs.io/en/latest/database.html And I don't have a problem with that, but as that same page makes clear, the db being accessed is still a test db that is being setup and then torn down, so why the 'need' to be 'conservative'? The real database isn't being touched at all, so there's no risk, or am I missing something? Thanks.

It's not conservative in order to prevent access to your real database. It's conservative according to the docs to "make it very clear what code uses the database."

I'd imagine it's also conservative in order to force you to write fewer tests that use a database so that your tests will run faster.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM