Fix test_memory to ignore UserWarning with gc.getobjects()
from __future__ import absolute_import, division, print_function
import gc
+import warnings
import networkx as nx
import pytest
@@ -17,6 +18,8 @@ pytestmark = pytest.mark.stage('unit')
def count_objects_of_type(type_):
+ with warnings.catch_warnings():
+ warnings.filterwarnings("ignore", category=UserWarning)
return sum(1 for obj in gc.get_objects() if isinstance(obj, type_))
