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

Remove dependency on mock #158

Closed
suriya opened this issue Jun 18, 2018 · 7 comments
Closed

Remove dependency on mock #158

suriya opened this issue Jun 18, 2018 · 7 comments

Comments

@suriya
Copy link
Contributor

suriya commented Jun 18, 2018

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?

@Stranger6667
Copy link
Owner

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.

@suriya
Copy link
Contributor Author

suriya commented Aug 26, 2018 via email

@Stranger6667
Copy link
Owner

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?

@Stranger6667 Stranger6667 reopened this Aug 26, 2018
@suriya
Copy link
Contributor Author

suriya commented Aug 26, 2018

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.

suriya added a commit to suriya/postmarker that referenced this issue Aug 31, 2018
These imports are defined in tests/_compat.py and used only in tests.

Fixes issue Stranger6667#158.
suriya added a commit to suriya/postmarker that referenced this issue Aug 31, 2018
@suriya
Copy link
Contributor Author

suriya commented Oct 21, 2018

@Stranger6667 Could you help with this issue?

@Stranger6667
Copy link
Owner

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

@suriya
Copy link
Contributor Author

suriya commented Nov 14, 2018

Thank you so much!

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

No branches or pull requests

2 participants