Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
75e48c5f
Unverified
Commit
75e48c5f
authored
Oct 25, 2024
by
Michael Šimáček
Committed by
GitHub
Oct 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip transient tests on GraalPy (#5422)
parent
f7e14e98
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
1 deletions
+23
-1
tests/test_call_policies.py
+2
-0
tests/test_class.py
+7
-0
tests/test_copy_move.py
+4
-0
tests/test_custom_type_casters.py
+2
-0
tests/test_eigen_matrix.py
+1
-0
tests/test_opaque_types.py
+3
-0
tests/test_operator_overloading.py
+4
-1
No files found.
tests/test_call_policies.py
View file @
75e48c5f
...
@@ -190,6 +190,7 @@ def test_alive_gc_multi_derived(capture):
...
@@ -190,6 +190,7 @@ def test_alive_gc_multi_derived(capture):
)
)
@pytest.mark.skipif
(
"env.GRAALPY"
,
reason
=
"Cannot reliably trigger GC"
)
def
test_return_none
(
capture
):
def
test_return_none
(
capture
):
n_inst
=
ConstructorStats
.
detail_reg_inst
()
n_inst
=
ConstructorStats
.
detail_reg_inst
()
with
capture
:
with
capture
:
...
@@ -217,6 +218,7 @@ def test_return_none(capture):
...
@@ -217,6 +218,7 @@ def test_return_none(capture):
assert
capture
==
"Releasing parent."
assert
capture
==
"Releasing parent."
@pytest.mark.skipif
(
"env.GRAALPY"
,
reason
=
"Cannot reliably trigger GC"
)
def
test_keep_alive_constructor
(
capture
):
def
test_keep_alive_constructor
(
capture
):
n_inst
=
ConstructorStats
.
detail_reg_inst
()
n_inst
=
ConstructorStats
.
detail_reg_inst
()
...
...
tests/test_class.py
View file @
75e48c5f
...
@@ -27,6 +27,9 @@ def test_instance(msg):
...
@@ -27,6 +27,9 @@ def test_instance(msg):
instance
=
m
.
NoConstructor
.
new_instance
()
instance
=
m
.
NoConstructor
.
new_instance
()
if
env
.
GRAALPY
:
pytest
.
skip
(
"ConstructorStats is incompatible with GraalPy."
)
cstats
=
ConstructorStats
.
get
(
m
.
NoConstructor
)
cstats
=
ConstructorStats
.
get
(
m
.
NoConstructor
)
assert
cstats
.
alive
()
==
1
assert
cstats
.
alive
()
==
1
del
instance
del
instance
...
@@ -35,6 +38,10 @@ def test_instance(msg):
...
@@ -35,6 +38,10 @@ def test_instance(msg):
def
test_instance_new
():
def
test_instance_new
():
instance
=
m
.
NoConstructorNew
()
# .__new__(m.NoConstructor.__class__)
instance
=
m
.
NoConstructorNew
()
# .__new__(m.NoConstructor.__class__)
if
env
.
GRAALPY
:
pytest
.
skip
(
"ConstructorStats is incompatible with GraalPy."
)
cstats
=
ConstructorStats
.
get
(
m
.
NoConstructorNew
)
cstats
=
ConstructorStats
.
get
(
m
.
NoConstructorNew
)
assert
cstats
.
alive
()
==
1
assert
cstats
.
alive
()
==
1
del
instance
del
instance
...
...
tests/test_copy_move.py
View file @
75e48c5f
...
@@ -2,6 +2,7 @@ from __future__ import annotations
...
@@ -2,6 +2,7 @@ from __future__ import annotations
import
pytest
import
pytest
import
env
# noqa: F401
from
pybind11_tests
import
copy_move_policies
as
m
from
pybind11_tests
import
copy_move_policies
as
m
...
@@ -17,6 +18,7 @@ def test_lacking_move_ctor():
...
@@ -17,6 +18,7 @@ def test_lacking_move_ctor():
assert
"is neither movable nor copyable!"
in
str
(
excinfo
.
value
)
assert
"is neither movable nor copyable!"
in
str
(
excinfo
.
value
)
@pytest.mark.skipif
(
"env.GRAALPY"
,
reason
=
"Cannot reliably trigger GC"
)
def
test_move_and_copy_casts
():
def
test_move_and_copy_casts
():
"""Cast some values in C++ via custom type casters and count the number of moves/copies."""
"""Cast some values in C++ via custom type casters and count the number of moves/copies."""
...
@@ -44,6 +46,7 @@ def test_move_and_copy_casts():
...
@@ -44,6 +46,7 @@ def test_move_and_copy_casts():
assert
c_m
.
alive
()
+
c_mc
.
alive
()
+
c_c
.
alive
()
==
0
assert
c_m
.
alive
()
+
c_mc
.
alive
()
+
c_c
.
alive
()
==
0
@pytest.mark.skipif
(
"env.GRAALPY"
,
reason
=
"Cannot reliably trigger GC"
)
def
test_move_and_copy_loads
():
def
test_move_and_copy_loads
():
"""Call some functions that load arguments via custom type casters and count the number of
"""Call some functions that load arguments via custom type casters and count the number of
moves/copies."""
moves/copies."""
...
@@ -77,6 +80,7 @@ def test_move_and_copy_loads():
...
@@ -77,6 +80,7 @@ def test_move_and_copy_loads():
@pytest.mark.skipif
(
not
m
.
has_optional
,
reason
=
"no <optional>"
)
@pytest.mark.skipif
(
not
m
.
has_optional
,
reason
=
"no <optional>"
)
@pytest.mark.skipif
(
"env.GRAALPY"
,
reason
=
"Cannot reliably trigger GC"
)
def
test_move_and_copy_load_optional
():
def
test_move_and_copy_load_optional
():
"""Tests move/copy loads of std::optional arguments"""
"""Tests move/copy loads of std::optional arguments"""
...
...
tests/test_custom_type_casters.py
View file @
75e48c5f
...
@@ -2,6 +2,7 @@ from __future__ import annotations
...
@@ -2,6 +2,7 @@ from __future__ import annotations
import
pytest
import
pytest
import
env
# noqa: F401
from
pybind11_tests
import
custom_type_casters
as
m
from
pybind11_tests
import
custom_type_casters
as
m
...
@@ -94,6 +95,7 @@ def test_noconvert_args(msg):
...
@@ -94,6 +95,7 @@ def test_noconvert_args(msg):
)
)
@pytest.mark.skipif
(
"env.GRAALPY"
,
reason
=
"Cannot reliably trigger GC"
)
def
test_custom_caster_destruction
():
def
test_custom_caster_destruction
():
"""Tests that returning a pointer to a type that gets converted with a custom type caster gets
"""Tests that returning a pointer to a type that gets converted with a custom type caster gets
destroyed when the function has py::return_value_policy::take_ownership policy applied.
destroyed when the function has py::return_value_policy::take_ownership policy applied.
...
...
tests/test_eigen_matrix.py
View file @
75e48c5f
...
@@ -395,6 +395,7 @@ def test_eigen_return_references():
...
@@ -395,6 +395,7 @@ def test_eigen_return_references():
np
.
testing
.
assert_array_equal
(
a_copy5
,
c5want
)
np
.
testing
.
assert_array_equal
(
a_copy5
,
c5want
)
@pytest.mark.skipif
(
"env.GRAALPY"
,
reason
=
"Cannot reliably trigger GC"
)
def
assert_keeps_alive
(
cl
,
method
,
*
args
):
def
assert_keeps_alive
(
cl
,
method
,
*
args
):
cstats
=
ConstructorStats
.
get
(
cl
)
cstats
=
ConstructorStats
.
get
(
cl
)
start_with
=
cstats
.
alive
()
start_with
=
cstats
.
alive
()
...
...
tests/test_opaque_types.py
View file @
75e48c5f
...
@@ -2,6 +2,7 @@ from __future__ import annotations
...
@@ -2,6 +2,7 @@ from __future__ import annotations
import
pytest
import
pytest
import
env
from
pybind11_tests
import
ConstructorStats
,
UserType
from
pybind11_tests
import
ConstructorStats
,
UserType
from
pybind11_tests
import
opaque_types
as
m
from
pybind11_tests
import
opaque_types
as
m
...
@@ -30,6 +31,8 @@ def test_pointers(msg):
...
@@ -30,6 +31,8 @@ def test_pointers(msg):
living_before
=
ConstructorStats
.
get
(
UserType
)
.
alive
()
living_before
=
ConstructorStats
.
get
(
UserType
)
.
alive
()
assert
m
.
get_void_ptr_value
(
m
.
return_void_ptr
())
==
0x1234
assert
m
.
get_void_ptr_value
(
m
.
return_void_ptr
())
==
0x1234
assert
m
.
get_void_ptr_value
(
UserType
())
# Should also work for other C++ types
assert
m
.
get_void_ptr_value
(
UserType
())
# Should also work for other C++ types
if
not
env
.
GRAALPY
:
assert
ConstructorStats
.
get
(
UserType
)
.
alive
()
==
living_before
assert
ConstructorStats
.
get
(
UserType
)
.
alive
()
==
living_before
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
with
pytest
.
raises
(
TypeError
)
as
excinfo
:
...
...
tests/test_operator_overloading.py
View file @
75e48c5f
...
@@ -2,7 +2,7 @@ from __future__ import annotations
...
@@ -2,7 +2,7 @@ from __future__ import annotations
import
pytest
import
pytest
import
env
# noqa: F401
import
env
from
pybind11_tests
import
ConstructorStats
from
pybind11_tests
import
ConstructorStats
from
pybind11_tests
import
operators
as
m
from
pybind11_tests
import
operators
as
m
...
@@ -51,6 +51,9 @@ def test_operator_overloading():
...
@@ -51,6 +51,9 @@ def test_operator_overloading():
v2
/=
v1
v2
/=
v1
assert
str
(
v2
)
==
"[2.000000, 8.000000]"
assert
str
(
v2
)
==
"[2.000000, 8.000000]"
if
env
.
GRAALPY
:
pytest
.
skip
(
"ConstructorStats is incompatible with GraalPy."
)
cstats
=
ConstructorStats
.
get
(
m
.
Vector2
)
cstats
=
ConstructorStats
.
get
(
m
.
Vector2
)
assert
cstats
.
alive
()
==
3
assert
cstats
.
alive
()
==
3
del
v1
del
v1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment