Stranger6667/postmarker

Remove dependency on mock

suriya opened this issue · 7 comments

Postmarker has a dependency on mock, used here:

from mock import patch # noqa

I notice that mock.patch is used only in tests. Does this make sense to move the line to a separate file _compat_tests.py so that normal usage of postmarker does not need the mock package?

Hi @suriya!
Sorry for not getting back to you.
This code is used in pytest integration, which is a part of the distribution. Thus it can't be moved to another place.

I completely agree with your motivation. The possible solution is to move mock to extras. For production, you could install postmarker and for your tests, you could install postmarker[testing] instead. What do you think?

My suggestion is simpler. Create a file called _compat_tests.py and import mock in that file. In production, that file will not be used.

@Stranger6667 Could you help with this issue?

Should be fixed now. In a case of any issues, feel free to reopen it

Thank you so much!