Enable Unittest for Django Projects in VSCode

Published: 28 January 2022
on channel: John Solly
6,492
52

Take full advantage of Visual Studio Code's support for unittesting

tests.py
from django.test import TestCase
from django import setup
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_project.settings")
setup()

Create your tests here.
from .models import Post

class PostTestCase(TestCase):
def test_queryset_exists(self):
qs = Post.objects.all()
self.assertTrue(qs.exists())


Watch video Enable Unittest for Django Projects in VSCode online without registration, duration hours minute second in high quality. This video was added by user John Solly 28 January 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 6,492 once and liked it 52 people.