Skip to content

Commit f239e13

Browse files
committed
Added initial testing module for stubgen tests.
1 parent 98bd78f commit f239e13

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ set(PYBIND11_TEST_FILES
169169
test_smart_ptr
170170
test_stl
171171
test_stl_binders
172+
test_stubgen
172173
test_tagbased_polymorphic
173174
test_thread
174175
test_type_caster_pyobject_ptr

tests/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ numpy~=1.21.5; platform_python_implementation=="CPython" and python_version>="3.
99
numpy~=1.22.2; platform_python_implementation=="CPython" and python_version=="3.10"
1010
numpy~=1.26.0; platform_python_implementation=="CPython" and python_version>="3.11" and python_version<"3.13"
1111
numpy~=2.2.0; platform_python_implementation=="CPython" and python_version=="3.13"
12+
pybind11-stubgen
1213
pytest>=6
1314
pytest-timeout
1415
scipy~=1.5.4; platform_python_implementation=="CPython" and python_version<"3.10"

tests/test_stubgen.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include "pybind11_tests.h"
2+
3+
TEST_SUBMODULE(stubgen, m) {
4+
m.def("add_int", [](int a, int b) { return a + b; }, "a"_a, "b"_a);
5+
}

tests/test_stubgen.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from __future__ import annotations
2+
3+
from pybind11_tests import stubgen as m
4+
5+
6+
def test_stubgen() -> None:
7+
assert m.add_int(1, 2) == 3

0 commit comments

Comments
 (0)