mock.py 816 B

12345678910111213141516171819202122232425
  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. NOTE: copied/adapted from SQLAlchemy master for backwards compatibility;
  9. this should be removable when Alembic targets SQLAlchemy 1.0.0
  10. """
  11. from __future__ import absolute_import
  12. from ..util.compat import py33
  13. if py33:
  14. from unittest.mock import MagicMock, Mock, call, patch, ANY
  15. else:
  16. try:
  17. from mock import MagicMock, Mock, call, patch, ANY # noqa
  18. except ImportError:
  19. raise ImportError(
  20. "SQLAlchemy's test suite requires the "
  21. "'mock' library as of 0.8.2.")