summaryrefslogtreecommitdiff
path: root/ext/pybind11/tests/test_keep_alive.py
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pybind11/tests/test_keep_alive.py')
-rw-r--r--ext/pybind11/tests/test_keep_alive.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/ext/pybind11/tests/test_keep_alive.py b/ext/pybind11/tests/test_keep_alive.py
index 0cef34658..bfd7d40c3 100644
--- a/ext/pybind11/tests/test_keep_alive.py
+++ b/ext/pybind11/tests/test_keep_alive.py
@@ -1,4 +1,4 @@
-import gc
+import pytest
def test_keep_alive_argument(capture):
@@ -9,14 +9,14 @@ def test_keep_alive_argument(capture):
assert capture == "Allocating parent."
with capture:
p.addChild(Child())
- gc.collect()
+ pytest.gc_collect()
assert capture == """
Allocating child.
Releasing child.
"""
with capture:
del p
- gc.collect()
+ pytest.gc_collect()
assert capture == "Releasing parent."
with capture:
@@ -24,11 +24,11 @@ def test_keep_alive_argument(capture):
assert capture == "Allocating parent."
with capture:
p.addChildKeepAlive(Child())
- gc.collect()
+ pytest.gc_collect()
assert capture == "Allocating child."
with capture:
del p
- gc.collect()
+ pytest.gc_collect()
assert capture == """
Releasing parent.
Releasing child.
@@ -43,14 +43,14 @@ def test_keep_alive_return_value(capture):
assert capture == "Allocating parent."
with capture:
p.returnChild()
- gc.collect()
+ pytest.gc_collect()
assert capture == """
Allocating child.
Releasing child.
"""
with capture:
del p
- gc.collect()
+ pytest.gc_collect()
assert capture == "Releasing parent."
with capture:
@@ -58,11 +58,11 @@ def test_keep_alive_return_value(capture):
assert capture == "Allocating parent."
with capture:
p.returnChildKeepAlive()
- gc.collect()
+ pytest.gc_collect()
assert capture == "Allocating child."
with capture:
del p
- gc.collect()
+ pytest.gc_collect()
assert capture == """
Releasing parent.
Releasing child.
@@ -77,11 +77,11 @@ def test_return_none(capture):
assert capture == "Allocating parent."
with capture:
p.returnNullChildKeepAliveChild()
- gc.collect()
+ pytest.gc_collect()
assert capture == ""
with capture:
del p
- gc.collect()
+ pytest.gc_collect()
assert capture == "Releasing parent."
with capture:
@@ -89,9 +89,9 @@ def test_return_none(capture):
assert capture == "Allocating parent."
with capture:
p.returnNullChildKeepAliveParent()
- gc.collect()
+ pytest.gc_collect()
assert capture == ""
with capture:
del p
- gc.collect()
+ pytest.gc_collect()
assert capture == "Releasing parent."