Repository: kvesteri/sqlalchemy-utils (language: python)

Issue:
use unittest.mock instead of mock in tests/types/test_password.py
Could you please consider to utilize unittest.mock, as a fallback at least?


Discussion / hints:
For what reason?
For sake of simplicity -- keeping unnecessary dependencies out.
https://trello.com/c/S6eADbii/64-remove-python-mock
https://fedoraproject.org/wiki/Changes/DeprecatePythonMock
Huh. The last time I looked at mock it was still introducing new features...must have been a long time ago. I didn't realize it had moved to backport-only mode after getting introduced to the standard library.

Thanks for this info, @pgajdos!
Yes, it is still developed as 'rolling backport of the standard library mock code compatible with Python 3.6 and up'. I have tested with python 3.8, 3.9 and 3.10 that unittest.mock suffices to the testsuite currently. If you want to stay with mock, it is possible to fallback to unittest.mock when mock is not installed.

Fix patch:
diff --git a/setup.py b/setup.py
index 8e17588a..0d2bad8d 100644
--- a/setup.py
+++ b/setup.py
@@ -27,7 +27,6 @@ def get_version():
         'Jinja2>=2.3',
         'docutils>=0.10',
         'flexmock>=0.9.7',
-        'mock==2.0.0',
         'psycopg2>=2.5.1',
         'psycopg2cffi>=2.8.1',
         'pg8000>=1.12.4',


Test patch:
diff --git a/tests/types/test_password.py b/tests/types/test_password.py
index 5e251a56..a1df28ee 100644
--- a/tests/types/test_password.py
+++ b/tests/types/test_password.py
@@ -1,4 +1,5 @@
-import mock
+import unittest.mock as mock
+
 import pytest
 import sqlalchemy as sa
 import sqlalchemy.dialects.mysql