pytest-django
pytest-django copied to clipboard
Option to keep db data after failed test in failfast mode ?
When a test fails, it'd be very interesting to be able to explore the remaining test database, to better understand what happened. Of course it would be only in a "failfast" case, eg. "-x" flag of pytest.
Is it already possible to obtain that ? If not, how could it be introduced ? By commiting instead of rollbacking the test transaction, I guess ?
Try --pdb - it will enter pdb for a failed test, and then you would have the DB there still (although in an atomic block (for db), i.e. not visible from outside of the test).
Thanks for the hint, I hadn't thought about this.
In your opinion, would it be feasible (and robust) to have a flag to commit/keep the DB test data "when it's the last test" (eg. "-x" flag and the likes, I dunno if pytest easily informs about that), so that it can be more easily viewed from pycharm/heidisql and the like ? (if there are no obvious showstoppers regarding the architecture of pytest-django, I might have a look at it)