@@ -48,15 +48,18 @@ def generate_bindings(cpp_code_block, module_name, tmp_path):
48
48
parsed_info = test_parse .get_parsed_info (
49
49
tmp_path = tmp_path , file_contents = cpp_code_block
50
50
)
51
+
52
+ file_include = "pcl" + parsed_info ["name" ].rsplit ("pcl" )[- 1 ]
53
+
51
54
# Get the binded code
52
55
binded_code = generate .generate (module_name = module_name , parsed_info = parsed_info )
53
56
# List to string
54
57
binded_code = "" .join (binded_code )
55
58
56
- return remove_whitespace (binded_code )
59
+ return f"#include< { file_include } >" , remove_whitespace (binded_code )
57
60
58
61
59
- def get_expected_string (expected_module_code ):
62
+ def get_expected_string (file_include , expected_module_code ):
60
63
"""
61
64
Returns expected output string after combining inclusions and pybind11's initial lines.
62
65
@@ -67,7 +70,7 @@ def get_expected_string(expected_module_code):
67
70
- expected_output (str): The stripped off, combined code.
68
71
"""
69
72
70
- file_include = "#include <file.cpp>"
73
+ # file_include = "#include <file.cpp>"
71
74
72
75
# Get pybind11's intial lines in the form of a string
73
76
initial_pybind_lines = "" .join (generate .bind ._initial_pybind_lines )
@@ -81,7 +84,7 @@ def get_expected_string(expected_module_code):
81
84
82
85
def test_struct_without_members (tmp_path ):
83
86
cpp_code_block = "struct AStruct {};"
84
- output = generate_bindings (
87
+ file_include , output = generate_bindings (
85
88
tmp_path = tmp_path , cpp_code_block = cpp_code_block , module_name = "pcl"
86
89
)
87
90
@@ -92,7 +95,9 @@ def test_struct_without_members(tmp_path):
92
95
}
93
96
"""
94
97
95
- assert output == get_expected_string (expected_module_code = expected_module_code )
98
+ assert output == get_expected_string (
99
+ file_include = file_include , expected_module_code = expected_module_code
100
+ )
96
101
97
102
98
103
def test_struct_with_members (tmp_path ):
@@ -101,7 +106,7 @@ def test_struct_with_members(tmp_path):
101
106
int aMember;
102
107
};
103
108
"""
104
- output = generate_bindings (
109
+ file_include , output = generate_bindings (
105
110
tmp_path = tmp_path , cpp_code_block = cpp_code_block , module_name = "pcl"
106
111
)
107
112
@@ -113,4 +118,6 @@ def test_struct_with_members(tmp_path):
113
118
}
114
119
"""
115
120
116
- assert output == get_expected_string (expected_module_code = expected_module_code )
121
+ assert output == get_expected_string (
122
+ file_include = file_include , expected_module_code = expected_module_code
123
+ )
0 commit comments