spacetelescope / stdatamodels

https://stdatamodels.readthedocs.io
Other
5 stars 24 forks source link

replace utcnow #231

Closed braingram closed 9 months ago

braingram commented 10 months ago

updates use of utcnow (deprecated in python 3.12) with an equivalent call that returns a non-timezone aware utc timestamp

Regression tests: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1023/

Showed the expected niriss failures due to crds file updates and also showed 2 failures:

As these tests appear to sometimes fail (possibly due to test ordering or io buffering) they were re-run in another test run: https://plwishmaster.stsci.edu:8081/blue/organizations/jenkins/RT%2FJWST-Developers-Pull-Requests/detail/JWST-Developers-Pull-Requests/1026/pipeline/199 where they both passed.

This PR removes one of the python 3.12 failures:

FAILED tests/test_util.py::test_create_history_entry - DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled ...

see in a CI run on main: https://github.com/spacetelescope/stdatamodels/actions/runs/6669314479/job/18126824996 but not seen in the CI run for this PR: https://github.com/spacetelescope/stdatamodels/actions/runs/6669380674/job/18127057458?pr=231

The remaining failures are due to crds use of ast.Str: https://github.com/spacetelescope/crds/issues/1000 The crds issues are addressed in: https://github.com/spacetelescope/crds/pull/1007 and a test PR with the changes in this PR and crds shows passing python 3.12 unit tests in stdatamodels: https://github.com/spacetelescope/stdatamodels/pull/233

Checklist

codecov[bot] commented 10 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (f42b477) 64.67% compared to head (bb201c6) 64.62%.

:exclamation: Current head bb201c6 differs from pull request most recent head 2611c05. Consider uploading reports for the commit 2611c05 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #231 +/- ## ========================================== - Coverage 64.67% 64.62% -0.05% ========================================== Files 102 102 Lines 5662 5660 -2 ========================================== - Hits 3662 3658 -4 - Misses 2000 2002 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hbushouse commented 9 months ago

@braingram Could you rebase with latest masters and run the regtests again?

braingram commented 9 months ago

There's a similar PR for jwst: https://github.com/spacetelescope/jwst/pull/8051 I was going to leave that as draft until the effort to support python 3.12 was started but should I update that jwst PR also (and open it for review)?

hbushouse commented 9 months ago

There's a similar PR for jwst: spacetelescope/jwst#8051 I was going to leave that as draft until the effort to support python 3.12 was started but should I update that jwst PR also (and open it for review)?

I don't see the harm in future proofing the code now, even before we're ready to allow py 3.12. That way it's ready to go, and any tests we run against 3.12 won't have this issue.

braingram commented 9 months ago

Regression tests running at: https://plwishmaster.stsci.edu:8081/job/RT/job/JWST-Developers-Pull-Requests/1058/

braingram commented 9 months ago

Regression tests passed with no errors.