pcdshub / happi

Heuristic Access to Positions of Photon Instruments
https://pcdshub.github.io/happi/master
Other
13 stars 29 forks source link

TST: Properly test with pymongo, adjust profiler usage for py3.12 #346

Closed tangkong closed 3 months ago

tangkong commented 3 months ago

Description

Motivation and Context

Seen in #343 and others

How Has This Been Tested?

CI

Where Has This Been Documented?

This PR

Pre-merge checklist

tangkong commented 3 months ago

Python 3.12 slightly changed how the built-in cprofiler behaves. Now the following raises an error:

import cProfile

p1 = cProfile.Profile()
p1.enable()

p2 = cProfile.Profile()
# previously, p1 is silently disabled here, now python raises
p1.disable()
p2.enable()

(a very helpful comment)

The py3.12 tests only fail on the cprofile test cases, which is consistent with this issue