Skip to content

Commit

Permalink
test test_engine_reference_cycle via weakref instead of gc
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Nov 7, 2023
1 parent 8b7f4d8 commit fe4d930
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pandas/tests/indexes/test_old_base.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from datetime import datetime
import gc
import weakref

import numpy as np
import pytest
Expand Down Expand Up @@ -744,10 +744,11 @@ def test_is_unique(self, simple_index):
@pytest.mark.arm_slow
def test_engine_reference_cycle(self, simple_index):
# GH27585
index = simple_index
nrefs_pre = len(gc.get_referrers(index))
index = simple_index.copy()
ref = weakref.ref(index)
index._engine
assert len(gc.get_referrers(index)) == nrefs_pre
del index
assert ref() is None

def test_getitem_2d_deprecated(self, simple_index):
# GH#30588, GH#31479
Expand Down

0 comments on commit fe4d930

Please sign in to comment.