Ticket #21671: 21671.diff

File 21671.diff, 1.7 KB (added by Claude Paroz, 10 years ago)

Skip when model_inheritance is not installed

  • tests/model_inheritance_same_model_name/models.py

    diff --git a/tests/model_inheritance_same_model_name/models.py b/tests/model_inheritance_same_model_name/models.py
    index a8c051f..eef4a7f 100644
    a b in the need for an %(app_label)s format string. This app specifically tests  
    66this feature by redefining the Copy model from model_inheritance/models.py
    77"""
    88
     9from django.conf import settings
    910from django.db import models
    1011
    1112from model_inheritance.models import NamedURL
    1213from django.utils.encoding import python_2_unicode_compatible
    1314
    1415
    15 #
    16 # Abstract base classes with related models
    17 #
    18 @python_2_unicode_compatible
    19 class Copy(NamedURL):
    20     content = models.TextField()
     16if 'model_inheritance' in settings.INSTALLED_APPS:
     17    #
     18    # Abstract base classes with related models
     19    #
     20    @python_2_unicode_compatible
     21    class Copy(NamedURL):
     22        content = models.TextField()
    2123
    22     def __str__(self):
    23         return self.content
     24        def __str__(self):
     25            return selfself.content
  • tests/model_inheritance_same_model_name/tests.py

    diff --git a/tests/model_inheritance_same_model_name/tests.py b/tests/model_inheritance_same_model_name/tests.py
    index fe1fb0c..ea88c39 100644
    a b  
    11from __future__ import unicode_literals
    22
     3from unittest import skipUnless
     4
     5from django.conf import settings
    36from django.test import TestCase
    47
    58from model_inheritance.models import Title
    69
    710
     11@skipUnless('model_inheritance' in settings.INSTALLED_APPS,
     12            "model_inheritance must be installed to run these tests.")
    813class InheritanceSameModelNameTests(TestCase):
    914
    1015    def setUp(self):
Back to Top