regebro / tzlocal

A Python module that tries to figure out what your local timezone is
MIT License
184 stars 58 forks source link

Unnecessary mock dep for py3 #86

Closed mgorny closed 3 years ago

mgorny commented 4 years ago

Python 3 provides mocking support in unittest.mock. Depending on external mock package shouldn't be necessary there.

regebro commented 4 years ago

Yes, but Python 2.7 does not. I'll keep this open as a reminder for when I drop Python 2.7 support.

mgorny commented 4 years ago

Many packages make the dependency conditional to Python version. This lets distributions who don't need Python 2 for this package anymore get rid of mock for Python 3 as well.

BenjamenMeyer commented 4 years ago

Yes, Py3 contains mock, however, I have found it to be useful to continue to depend on mock even in my Py3 code because the code changes from:

import mock

to

from unittest import mock

I'm glad they integrated the base functionality of mocking; but the interface change is important too. Further, packages like six don't map that move either since mock wasn't part of Py2. There's also no real difference between installing mock and continuing to use unittest.mock - they're both feature equivalent.

IIRC, mock is maintained similarly to argparse; there's still an argparse package out there and you can choose to depend on it too if you like, but with Py2 it wasn't required. That at least was a little cleaner integration/change than mock has been.

$0.02 FWIW

pganssle commented 3 years ago

Python 2 support was dropped in #92, so this can be closed.

regebro commented 3 years ago

Right, thanks for the headsup, this is indeed done now, thanks to Alex.