Hi Alex. Usually, unit tests create their own database for each test ran.
This is automatic with django tests.

Read more there:
https://docs.djangoproject.com/en/2.1/topics/testing/overview/

You can use settings.py to set up a test db, and set dba speaks for test :
if 'test' in sys.argv:
    Xxx

 if you need prepopulated data, use fixtures.
https://code.djangoproject.com/wiki/Fixtures

Then destroy it at the end. That's called 'isolation', then you can run
tests in any order and even in parallel sometime.

Marc.

Le mer. 22 août 2018 à 07:46, Alexander Lamas <alexander.g.la...@gmail.com>
a écrit :

> Hi guys,
>
> Does anyone know how to setup a Django Rest Framework Web Api application*,
> maybe settings.py*,
> to create it's own testing database on the fly and then dropping the
> database when unit tests are finished?
>
> Does it require a special setting somewhere?
>
> Or do I need to have a dev_settings.py / unittest_settings.py with
> specific settings?
>
> NOTE: I'm running my unit tests via Microsoft Visual Studio.
>
> Thank you very much!
>
> Regards,
> Alex
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django REST framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-rest-framework+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-rest-framework+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to