txtorcon icon indicating copy to clipboard operation
txtorcon copied to clipboard

use unittest.mock instead of mock

Open pgajdos opened this issue 2 years ago • 2 comments

I see you still support python2, so dropping mock entirely is not option for you, but could you consider to use untitest.mock as a fallback at least, when mock is not installed?

pgajdos avatar Apr 20 '22 11:04 pgajdos

Yes, I'd accept a PR to do that :)

And really, I don't think there's a good reason anymore to support python2; major projects that I know that use this already support python3 ... so basically just waiting for "something painful" to simply drop python2 support entirely.

And then it would be nice to get rid of some of the "py3 hoops" that exist, like the separate test/implementation files etc as well

meejah avatar Apr 20 '22 16:04 meejah

I am not sure how the pr should look like then ;). In case you do not consider python2, then sed -i 's:from mock:from unittest.mock:' test/*.py do the trick for me on 3.8 to 3.10. In opposite case it is slightly worse, however I am not sure it is worth the work given the statement above. I think it can wait until you decide to drop python2 support.

pgajdos avatar Apr 21 '22 07:04 pgajdos

Python2 support is now dropped.

meejah avatar Feb 16 '23 06:02 meejah