plone.restapi icon indicating copy to clipboard operation
plone.restapi copied to clipboard

Fix test_statictime for p.a.discussion comments

Open instification opened this issue 2 years ago • 2 comments

Needed for https://github.com/plone/plone.app.discussion/pull/204

Tests won't pass until https://github.com/plone/plone.app.discussion/pull/204 is merged as it is a co-dependent change.

Updating p.a.discussion to set timezone aware times.

The current test is checking for a timezone, but there isn't one so the following code wasn't getting executed:

if pydt.tzinfo is not None:
    now = pydt.tzinfo.localize(now)

but pydt.tzinfo.localize is not a function so I have removed this check.

As the times coming from p.a.discussion will be tz aware, this update fixes the tests to compare using timezones.

instification avatar Oct 18 '22 15:10 instification

Deploy Preview for plone-restapi canceled.

Name Link
Latest commit b65ca02a8330598ca5beb47ef6ce7904cdc26003
Latest deploy log https://app.netlify.com/sites/plone-restapi/deploys/63570a06de26c600091895f1

netlify[bot] avatar Oct 18 '22 15:10 netlify[bot]

@instification thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

mister-roboto avatar Oct 18 '22 15:10 mister-roboto

@instification Is it possible to make this work both with and without the change in plone.app.discussion? The challenge is that plone.restapi still supports both Plone 5.2 and Plone 6.0 from a single release branch, but the change in plone.app.discussion to use timezone-aware datetimes is for Plone 6 only.

davisagli avatar Oct 23 '22 22:10 davisagli