mock.py 651 B

123456789101112131415161718192021
  1. # testing/mock.py
  2. # Copyright (C) 2005-2017 the SQLAlchemy authors and contributors
  3. # <see AUTHORS file>
  4. #
  5. # This module is part of SQLAlchemy and is released under
  6. # the MIT License: http://www.opensource.org/licenses/mit-license.php
  7. """Import stub for mock library.
  8. """
  9. from __future__ import absolute_import
  10. from ..util import py33
  11. if py33:
  12. from unittest.mock import MagicMock, Mock, call, patch, ANY
  13. else:
  14. try:
  15. from mock import MagicMock, Mock, call, patch, ANY
  16. except ImportError:
  17. raise ImportError(
  18. "SQLAlchemy's test suite requires the "
  19. "'mock' library as of 0.8.2.")