sot / chandra_aca

Chandra Aspect Camera Tools
https://sot.github.io/chandra_aca
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

fix in planets.py: cleanup jplephem.spk.SPK at exit #143

Closed javierggt closed 1 year ago

javierggt commented 1 year ago

Description

The current sparkles unit test on masters (ska3-prime) has the following warning at the end:

sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='/export/jgonzale/github-workflows/miniconda3/envs/ska3-masters-prime/lib/python3.10/site-packages/chandra_aca/data/de432s.bsp'>

This is caused by chandra_aca.planets.load_kernel, which opens a file that is never closed. This PR adds a cleanup function to fix that.

Interface impacts

None

Testing

Unit tests

Independent check of unit tests by [REVIEWER NAME]

Functional tests

I ran sparkles unit test using this branch and this silenced the warning.