File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
tests/integrations/sqlalchemy Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 1+ import contextlib
12import os
23from datetime import datetime
34from unittest import mock
@@ -619,21 +620,15 @@ class Person(Base):
619620 bob = Person (name = "Bob" )
620621 session .add (bob )
621622
622- class fake_record_sql_queries : # noqa: N801
623- def __init__ ( self , * args , ** kwargs ):
624- with freeze_time (datetime (2024 , 1 , 1 , microsecond = 0 )):
625- with record_sql_queries (* args , ** kwargs ) as span :
626- self . span = span
627- freezer = freeze_time ( datetime ( 2024 , 1 , 1 , microsecond = 99999 ) )
628- freezer . start ()
623+ @ contextlib . contextmanager
624+ def fake_record_sql_queries ( * args , ** kwargs ): # noqa: N801
625+ with freeze_time (datetime (2024 , 1 , 1 , second = 0 )):
626+ with record_sql_queries (* args , ** kwargs ) as span :
627+ freezer = freeze_time ( datetime ( 2024 , 1 , 1 , second = 1 ))
628+ freezer . start ( )
629+ yield span
629630
630- freezer .stop ()
631-
632- def __enter__ (self ):
633- return self .span
634-
635- def __exit__ (self , type , value , traceback ):
636- pass
631+ freezer .stop ()
637632
638633 with mock .patch (
639634 "sentry_sdk.integrations.sqlalchemy.record_sql_queries" ,
You can’t perform that action at this time.
0 commit comments