Skip to content

Commit 6e7e131

Browse files
committed
Add GC collections
1 parent 96d7292 commit 6e7e131

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

econml/tests/test_causal_analysis.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from numpy.core.fromnumeric import squeeze
1010
import pandas as pd
1111
import pytest
12+
import gc
1213

1314
from econml.solutions.causal_analysis import CausalAnalysis
1415
from econml.solutions.causal_analysis._causal_analysis import _CausalInsightsConstants
@@ -692,6 +693,9 @@ def test_random_state(self):
692693
np.testing.assert_equal(glo.point.values, glo2.point.values)
693694
np.testing.assert_equal(glo.stderr.values, glo2.stderr.values)
694695

696+
del ca, glo, ca2, glo
697+
gc.collect()
698+
695699
def test_can_set_categories(self):
696700
y = pd.Series(np.random.choice([0, 1], size=(500,)))
697701
X = pd.DataFrame({'a': np.random.normal(size=500),
@@ -785,6 +789,9 @@ def test_invalid_inds(self):
785789
self.assertEqual(ca.untrained_feature_indices_, [(4, 'cat_limit'),
786790
(5, 'cat_limit')])
787791

792+
del ca
793+
gc.collect()
794+
788795
# Add tests that guarantee that the reliance on DML feature order is not broken, such as
789796
# Creare a transformer that zeros out all variables after the first n_x variables, so it zeros out W
790797
# Pass an example where W is irrelevant and X is confounder

0 commit comments

Comments
 (0)