Skip to content

Fixes serializer tests failing locally in Ginkgo - #414

Merged
johnbaldwin merged 2 commits into
masterfrom
john/ginkgo-fix-serializer-tests
Jan 26, 2022
Merged

johnbaldwin merged 2 commits into
masterfrom
john/ginkgo-fix-serializer-tests

Conversation

@johnbaldwin

Copy link
Copy Markdown
Contributor
  • The version 2.4.2 dateutil.parser.parse method returns a datetime
    object in local time, causing the tests to fail when compared against
    datetime in UTC
  • This commit addresses the issue by replacing the timezone with UTC
  • This commit includes a helper function, as_datetime_utc in tests/test_serializers.py
  • Read the docstring for this helper function

* The version 2.4.2 `dateutil.parser.parse` method returns a `datetime`
object in local time, causing the tests to fail when compared against
datetime in UTC
* This commit addresses the issue by replacing the timezone with UTC
* This commit includes a helper function, `as_datetime_utc` in tests/test_serializers.py
* Read the docstring for this helper function

@bryanlandia bryanlandia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense, but would this function be better put into a test utils module rather than just in this specific serializers test module?

https://github.com/appsembler/figures/search?q=dateutil.parser

shows a lot of files using a dateutil_parse. Maybe at least put this func in test_helpers.py

I'll approve but please consider

@johnbaldwin

Copy link
Copy Markdown
Contributor Author

@bryanlandia I updated per your request

@johnbaldwin
johnbaldwin merged commit 596df83 into master Jan 26, 2022
@johnbaldwin
johnbaldwin deleted the john/ginkgo-fix-serializer-tests branch January 26, 2022 19:11
@bryanlandia

Copy link
Copy Markdown
Contributor

Thanks @johnbaldwin Looks like as_datetime_utc could probably be used here too

the_date = dateutil_parse(the_date_str).date()

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.

3 participants