When you use django unittests commit is made as no-op. Use --keepdb and at
the end of your tests run SQL commit against your database cursor
connection.

On Wed, Feb 13, 2019 at 5:54 AM Anton Melser <[email protected]> wrote:

> Hi,
>
> I can't work out whether it is expected or whether I am missing something.
> I would like to keep the DB data that I generate during a test run to
> inspect/persist it. --keepdb means I have empty tables at the end,
> strangely even if I ctrl-C a test run. It would also be logical for test
> data to get cleaned... Is there an option I can add to keep it?
>
> I have a lot of calls to external services that should be mocked. The json
> returned from these calls is put in the DB as-is, so if I can just set up
> an initial run of the tests and then get the data from the DB that would be
> optimal. I could add file writes about the place to persist, but I want to
> evolve the test data over time and will need to do this often, so being
> able to do that from the DB would be very handy.
>
> Any pointers?
>
> Thanks,
> Anton
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/f9d2dfe3-c832-45bd-a6d3-7f3415f1293d%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/f9d2dfe3-c832-45bd-a6d3-7f3415f1293d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Jani Tiainen

- Well planned is half done, and a half done has been sufficient before...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofX4s7zouEtU-3OMuzQuRWFUw6v-uqHVEixjKPgy-p5ww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to