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

Time zone capitilization #164

Merged
merged 5 commits into from
Jun 11, 2020
Merged

Conversation

scotthavens
Copy link
Contributor

inicheck parses the time_zone value to lowercase, which is fine for UTC but not any other time zones. Added a custom parser that will perform no checking and return the raw string provided. pytz will error if the timezone cannot be found.

@scotthavens scotthavens requested a review from jomey June 11, 2020 19:21
@@ -53,15 +53,21 @@ class TestModelFrameworkMST(SMRFTestCase):
"""
Test timezone handling for MST.
"""
TIMEZONE = pytz.timezone('US/Mountain')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Little did I know that MST is the way to go and 'US/Mountain' is deprecated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

US/Mountain will also apply daylight savings time so you can either miss an hour or double up.


@classmethod
def setUpClass(cls):
super().setUpClass()
base_config = copy.deepcopy(cls.base_config)
base_config.cfg['time']['time_zone'] = str(cls.TIMEZONE)
base_config.cfg['time']['time_zone'] = 'MST'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did this call need to b changed?
Or did you want to create a more 'real world' input scenario with it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a more real world application as we don't typically pass a pytz object. This will also test that the inicheck parser is working. Then TIMEZONE becomes what is checked against

value: A single string unchanged
"""

return value
Copy link
Collaborator

Choose a reason for hiding this comment

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

Think this would be worth opening a ticket for and move into 'inicheck'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now we can flip a coin :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You got a lower number so you won!

@scotthavens scotthavens merged commit dfd3948 into USDA-ARS-NWRC:master Jun 11, 2020
@scotthavens scotthavens deleted the 96_time_zone branch June 11, 2020 20:40
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