Skip to content

Fix tests on non-UTC systems#428

Merged
bio-boris merged 2 commits intodevelopfrom
dev-fix_tests_on_non_UTC_systems
Dec 20, 2021
Merged

Fix tests on non-UTC systems#428
bio-boris merged 2 commits intodevelopfrom
dev-fix_tests_on_non_UTC_systems

Conversation

@MrCreosote
Copy link
Copy Markdown
Member

Description of PR purpose/changes

The tests pass with or without the changes in this commit in the docker
container, which is UTC, but fail without the changes on my laptop, which is
not UTC.

The problem is that datetime.utcnow() is not timezone aware, so it
only works on UTC systems.

Jira Ticket / Github Issue

  • [n/a] Added the Jira Ticket to the title of the PR e.g. (DATAUP-69 Adds a PR template)

Testing Instructions

  • Details for how to test the PR:
  • Tests pass in Github Actions and locally
  • Changes available by spinning up a local test suite and running tests

Dev Checklist:

  • My code follows the guidelines at https://sites.google.com/truss.works/kbasetruss/data-upload-project/development
  • I have performed a self-review of my own code
  • [n/a] I have commented my code, particularly in hard-to-understand areas
  • [n/a] I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • [n/a] Any dependent changes have been merged and published in downstream modules
  • I have run Black and Flake8 on changed Python Code manually or with git precommit (and the Github Actions build passes)

Updating Version and Release Notes (if applicable)

The tests pass with or without the changes in this commit in the docker
container, which is UTC, but fail without the changes on my laptop, which is
not UTC.

The problem is that `datetime.utcnow()` is not timezone aware, so it
only works on UTC systems.
@MrCreosote MrCreosote requested a review from bio-boris December 17, 2021 23:48
@bio-boris
Copy link
Copy Markdown
Collaborator

@MrCreosote It should probably be "time.time()" in order to match the other timestamps

@MrCreosote
Copy link
Copy Markdown
Member Author

@bio-boris updated

@bio-boris bio-boris merged commit a7a2d8a into develop Dec 20, 2021
@MrCreosote MrCreosote deleted the dev-fix_tests_on_non_UTC_systems branch December 20, 2021 02:53
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