Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use unittest.mock instead of mock #157

Open
pgajdos opened this issue May 9, 2022 · 2 comments
Open

use unittest.mock instead of mock #157

pgajdos opened this issue May 9, 2022 · 2 comments
Labels

Comments

@pgajdos
Copy link

pgajdos commented May 9, 2022

Could you please consider to use unittest.mock instead of mock as a fallback? You seem to support older python versions, so you probably cannot really get rid of it completely for now.

https://trello.com/c/S6eADbii/64-remove-python-mock
https://fedoraproject.org/wiki/Changes/DeprecatePythonMock

@pgajdos pgajdos added the bug label May 9, 2022
@pgajdos
Copy link
Author

pgajdos commented May 9, 2022

At least for 3.8, 3.9 and 3.10 following works for me:

--- django-mailer-2.2.orig/tests/test_mailer.py	2022-05-09 17:23:15.968311514 +0200
+++ django-mailer-2.2/tests/test_mailer.py	2022-05-09 17:23:15.976311564 +0200
@@ -12,7 +12,7 @@ from django.core.exceptions import Impro
 from django.core.management import call_command
 from django.test import TestCase
 from django.utils.timezone import now as datetime_now
-from mock import Mock, patch
+from unittest.mock import Mock, patch
 import six
 
 import mailer

@jaap3
Copy link
Contributor

jaap3 commented Jun 19, 2023

Older python versions were recently removed from the tests matrix, so a PR that uses unittest.mock instead of the mock library should now be feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants