File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1
1
--extra-index-url=https://www.graalvm.org/python/wheels
2
2
--only-binary =:all:
3
3
build >= 1
4
+ mypy
4
5
numpy ~= 1.23.0 ; python_version == "3.8" and platform_python_implementation=="PyPy"
5
6
numpy ~= 1.25.0 ; python_version == "3.9" and platform_python_implementation=="PyPy"
6
7
numpy ~= 2.2.0 ; python_version == "3.10" and platform_python_implementation=="PyPy"
Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
+ from pathlib import Path
4
+
5
+ import pybind11_stubgen as stubgen
6
+ from mypy import api
7
+
3
8
from pybind11_tests import stubgen as m
4
9
5
10
6
- def test_stubgen () -> None :
11
+ def test_stubgen (tmp_path : Path ) -> None :
7
12
assert m .add_int (1 , 2 ) == 3
13
+
14
+ stubgen .main (
15
+ [
16
+ "pybind11_tests.stubgen" ,
17
+ "-o" ,
18
+ tmp_path .as_posix (),
19
+ ]
20
+ )
21
+ print (f"Stubgen output: { tmp_path .as_posix ()} " )
22
+ stub_file = tmp_path / "pybind11_tests" / "stubgen.pyi"
23
+ assert stub_file .exists ()
24
+ stub_content = stub_file .read_text ()
25
+ assert (
26
+ "def add_int(a: typing.SupportsInt, b: typing.SupportsInt) -> int:"
27
+ in stub_content
28
+ )
29
+ normal_report , error_report , exit_status = api .run ([stub_file .as_posix ()])
30
+ print ("Normal report:" )
31
+ print (normal_report )
32
+ print ("Error report:" )
33
+ print (error_report )
34
+ assert exit_status == 0
35
+ assert "Success: no issues found in 1 source file" in normal_report
You can’t perform that action at this time.
0 commit comments