About Skipping Test Cases

You can skip test cases based on settings with the @unittest.skipIf decorator:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import unittest
from django.test import LiveServerTestCase
from django.conf import settings

@unittest.skipIf(
    not settings.IS_FEATURE_X_ACTIVE, 
    "Skipping tests for feature X."
)
class FeatureXTest(LiveServerTestCase):
    ...

Tips and Tricks Programming Testing Django 4.2 Django 3.2 Django 2.2