meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
249 stars 72 forks source link

use unittest.mock instead of mock #368

Closed pgajdos closed 1 year ago

pgajdos commented 2 years ago

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?

meejah commented 2 years ago

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

pgajdos commented 2 years ago

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.

meejah commented 1 year ago

Python2 support is now dropped.