micro-fan/pytest-tipsi-django

Example

Opened this issue · 1 comments

Do you have an example on how to use this?

@larsrinn no readme for now, but you may check tests:
https://github.com/tipsi/pytest-tipsi-django/blob/master/test_django_plugin/app/tests/test_transactions.py

There are several pitfalls:

  • if you've changed module scoped model instance, you must wrap it in transaction and refresh_from_db upon test exit
  • if you want to perform model instance .delete - it's better not to do it on non-function scoped fixtures

In general, we're performing migration of our internal codebase and all major things seem working and we're happy with it.
But because of pytest design: no clean way to finish fixture, no guarantees about whether fixture will exist for your function or not for particular test and some other things - debugging seems harder.