Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

import gc
import platform
import weakref
from unittest import mock

Expand Down Expand Up @@ -82,6 +83,12 @@ def test_do_not_leak_response(self, url, sess):
# We should not break this.

resp = None
if platform.python_implementation() == "PyPy":
# NOTE: Need to explicitly tell PyPy to collect at this point.
# See: https://github.com/psf/cachecontrol/issues/351
# See: https://doc.pypy.org/en/latest/cpython_differences.html#differences-related-to-garbage-collection-strategies
gc.collect()

# Below this point, it should be closed because there are no more references
# to the session response.

Expand Down
Loading