Commits

Aymeric Augustin committed cb016d8

Use the stdlib version of mock for tests on Python 3.

Comments (0)

Files changed (2)

 from setuptools import setup
 
 try:
+    import unittest.mock    # noqa
+except ImportError:
+    requires_mock = ['mock']
+else:
+    requires_mock = []
+
+try:
     import unittest2  # noqa
 except ImportError:
     test_loader = 'unittest:TestLoader'
     install_requires=[
         'python-ldap',
         'funcparserlib==0.3.6',
-        'mock',
-    ],
+    ] + requires_mock,
     extras_require={
         'passlib': ['passlib>=1.6.1'],
     },

src/mockldap/__init__.py

         then you need to call ``start('path.to.your.mod.initialize')``. See
         :ref:`where-to-patch` for more.
         """
-        from mock import patch
+        try:
+            from unittest.mock import patch
+        except ImportError:
+            from mock import patch
 
         if path in self.patchers:
             raise ValueError("%r is already patched." % (path,))