__init__.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # coding=utf-8
  2. #
  3. # This file is part of Hypothesis, which may be found at
  4. # https://github.com/HypothesisWorks/hypothesis-python
  5. #
  6. # Most of this work is copyright (C) 2013-2018 David R. MacIver
  7. # (david@drmaciver.com), but it contains contributions by others. See
  8. # CONTRIBUTING.rst for a full list of people who may hold copyright, and
  9. # consult the git log if you need to determine who owns an individual
  10. # contribution.
  11. #
  12. # This Source Code Form is subject to the terms of the Mozilla Public License,
  13. # v. 2.0. If a copy of the MPL was not distributed with this file, You can
  14. # obtain one at http://mozilla.org/MPL/2.0/.
  15. #
  16. # END HEADER
  17. import unittest
  18. import django.test as dt
  19. class HypothesisTestCase(object):
  20. def setup_example(self):
  21. self._pre_setup()
  22. def teardown_example(self, example):
  23. self._post_teardown()
  24. def __call__(self, result=None):
  25. testMethod = getattr(self, self._testMethodName)
  26. if getattr(testMethod, u'is_hypothesis_test', False):
  27. return unittest.TestCase.__call__(self, result)
  28. else:
  29. return dt.SimpleTestCase.__call__(self, result)
  30. class TestCase(HypothesisTestCase, dt.TestCase):
  31. pass
  32. class TransactionTestCase(HypothesisTestCase, dt.TransactionTestCase):
  33. pass