File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,11 +137,7 @@ TEST_CASE("Override cache") {
137137}
138138
139139TEST_CASE (" Import error handling" ) {
140- auto module_ = py::module_::import (" widget_module" );
141-
142- // Also verify submodules work
143- REQUIRE (module_.attr (" add" )(1 , 41 ).cast <int >() == 42 );
144- REQUIRE (module_.attr (" sub" ).attr (" add" )(1 , 41 ).cast <int >() == 42 );
140+ REQUIRE_NOTHROW (py::module_::import (" widget_module" ));
145141
146142 REQUIRE_THROWS_WITH (py::module_::import (" throw_exception" ), " ImportError: C++ Error" );
147143 REQUIRE_THROWS_WITH (py::module_::import (" throw_error_already_set" ),
@@ -323,6 +319,9 @@ TEST_CASE("Restart the interpreter") {
323319 // C++ modules can be reloaded.
324320 auto cpp_module = py::module_::import (" widget_module" );
325321 REQUIRE (cpp_module.attr (" add" )(1 , 2 ).cast <int >() == 3 );
322+
323+ // Also verify submodules work
324+ REQUIRE (module_.attr (" sub" ).attr (" add" )(1 , 41 ).cast <int >() == 42 );
326325
327326 // C++ type information is reloaded and can be used in python modules.
328327 auto py_module = py::module_::import (" test_interpreter" );
You can’t perform that action at this time.
0 commit comments