@@ -500,7 +500,10 @@ def test_extract_stack_with_max_depth(depth, max_stack_depth, actual_depth):
500
500
# increase the max_depth by the `base_stack_depth` to account
501
501
# for the extra frames pytest will add
502
502
_ , frame_ids , frames = extract_stack (
503
- frame , LRUCache (max_size = 1 ), max_stack_depth = max_stack_depth + base_stack_depth
503
+ frame ,
504
+ LRUCache (max_size = 1 ),
505
+ max_stack_depth = max_stack_depth + base_stack_depth ,
506
+ cwd = os .getcwd (),
504
507
)
505
508
assert len (frame_ids ) == base_stack_depth + actual_depth
506
509
assert len (frames ) == base_stack_depth + actual_depth
@@ -527,8 +530,9 @@ def test_extract_stack_with_max_depth(depth, max_stack_depth, actual_depth):
527
530
def test_extract_stack_with_cache (frame , depth ):
528
531
# make sure cache has enough room or this test will fail
529
532
cache = LRUCache (max_size = depth )
530
- _ , _ , frames1 = extract_stack (frame , cache )
531
- _ , _ , frames2 = extract_stack (frame , cache )
533
+ cwd = os .getcwd ()
534
+ _ , _ , frames1 = extract_stack (frame , cache , cwd = cwd )
535
+ _ , _ , frames2 = extract_stack (frame , cache , cwd = cwd )
532
536
533
537
assert len (frames1 ) > 0
534
538
assert len (frames2 ) > 0
@@ -667,7 +671,16 @@ def test_thread_scheduler_single_background_thread(scheduler_class):
667
671
)
668
672
@mock .patch ("sentry_sdk.profiler.MAX_PROFILE_DURATION_NS" , 1 )
669
673
def test_max_profile_duration_reached (scheduler_class ):
670
- sample = [("1" , extract_stack (get_frame (), LRUCache (max_size = 1 )))]
674
+ sample = [
675
+ (
676
+ "1" ,
677
+ extract_stack (
678
+ get_frame (),
679
+ LRUCache (max_size = 1 ),
680
+ cwd = os .getcwd (),
681
+ ),
682
+ ),
683
+ ]
671
684
672
685
with scheduler_class (frequency = 1000 ) as scheduler :
673
686
transaction = Transaction (sampled = True )
@@ -711,8 +724,18 @@ def ensure_running(self):
711
724
712
725
713
726
sample_stacks = [
714
- extract_stack (get_frame (), LRUCache (max_size = 1 ), max_stack_depth = 1 ),
715
- extract_stack (get_frame (), LRUCache (max_size = 1 ), max_stack_depth = 2 ),
727
+ extract_stack (
728
+ get_frame (),
729
+ LRUCache (max_size = 1 ),
730
+ max_stack_depth = 1 ,
731
+ cwd = os .getcwd (),
732
+ ),
733
+ extract_stack (
734
+ get_frame (),
735
+ LRUCache (max_size = 1 ),
736
+ max_stack_depth = 2 ,
737
+ cwd = os .getcwd (),
738
+ ),
716
739
]
717
740
718
741
@@ -805,7 +828,7 @@ def ensure_running(self):
805
828
"stacks" : [[0 ], [1 , 0 ]],
806
829
"thread_metadata" : thread_metadata ,
807
830
},
808
- id = "two identical stacks" ,
831
+ id = "two different stacks" ,
809
832
),
810
833
],
811
834
)
0 commit comments