Skip to content

Conversation

@wrieg123
Copy link
Collaborator

datetime.datetime.utcnow() is deprecated and creates lots of warnings in tests, added utc_now() to csp.utils.datetime

del runner
self.assertTrue(output.get("stop"))
self.assertLess(output["stop"], endtime)
self.assertLess(output["stop"], endtime.replace(tzinfo=None))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a tz-aware comparison, removes the tz from the endtime

self.assertFalse(runner.is_alive())
self.assertTrue(output.get("stop"))
self.assertLess(output["stop"], endtime)
self.assertLess(output["stop"], endtime.replace(tzinfo=None))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is a tzaware comparison, removes tzinfo for comparison

@wrieg123 wrieg123 added type: enhancement Issues and PRs related to improvements to existing features lang: python Issues and PRs related to the Python codebase labels Dec 24, 2025


def utc_now() -> datetime:
return datetime.now(timezone.utc)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should add replace(tzinfo=None) here so its consistent with current utcnow() calls and potential csp expectations

Signed-off-by: Will Rieger <will.r.rieger@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lang: python Issues and PRs related to the Python codebase type: enhancement Issues and PRs related to improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants