django_compat.py 417 B

1234567891011121314
  1. # Note that all functions here assume django is available. So ensure
  2. # this is the case before you call them.
  3. def is_django_unittest(request_or_item):
  4. """Returns True if the request_or_item is a Django test case, otherwise False"""
  5. from django.test import SimpleTestCase
  6. cls = getattr(request_or_item, 'cls', None)
  7. if cls is None:
  8. return False
  9. return issubclass(cls, SimpleTestCase)