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

darwin: allow to use the TZ environment variable to override #46

Merged
merged 1 commit into from
Oct 21, 2017

Conversation

jd
Copy link
Contributor

@jd jd commented Oct 16, 2017

This works on Darwin too.

tzenv = os.environ.get('TZ')
if tzenv:
try:
return pytz.timezone(tzenv)
Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, fixed :)

@jd
Copy link
Contributor Author

jd commented Oct 17, 2017

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()
Copy link
Owner

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()

@jd
Copy link
Contributor Author

jd commented Oct 21, 2017

Pull-request updated, HEAD is now 2294b65

@jd
Copy link
Contributor Author

jd commented Oct 21, 2017

Pull-request updated, HEAD is now d991240

@regebro regebro merged commit 6baa543 into regebro:master Oct 21, 2017
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

Successfully merging this pull request may close these issues.

2 participants