-
Notifications
You must be signed in to change notification settings - Fork 58
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
darwin: allow to use the TZ environment variable to override #46
Conversation
tzlocal/darwin.py
Outdated
tzenv = os.environ.get('TZ') | ||
if tzenv: | ||
try: | ||
return pytz.timezone(tzenv) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in that case we should support the same thing as we do for Linux, so we need to use the _tz_from_env() function from unix.py.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, fixed :)
Pull-request updated, HEAD is now 43df09b |
tzlocal/unix.py
Outdated
@@ -35,12 +45,9 @@ def _get_localzone(_root='/'): | |||
beneath the _root directory. This is primarily used by the tests. | |||
In normal usage you call the function without parameters.""" | |||
|
|||
tzenv = os.environ.get('TZ') | |||
tzenv = pytz.unix._try_tz_from_venv() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, which is why the tests fail. It should be just _try_tz_from_venv()
Pull-request updated, HEAD is now 2294b65 |
This works on Darwin too.
Pull-request updated, HEAD is now d991240 |
This works on Darwin too.