Skip to content

Commit 0f9d2fa

Browse files
committed
Add debug fprintf to test_interpreter.cpp
1 parent 790e44e commit 0f9d2fa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/test_embed/test_interpreter.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,19 @@ bool has_pybind11_internals_static() {
173173

174174
TEST_CASE("Restart the interpreter") {
175175
// Verify pre-restart state.
176+
fprintf(stdout,
177+
"\nLOOOK PYTHONPATH %s\n",
178+
py::module_::import("os")
179+
.attr("environ")
180+
.attr("get")("PYTHONPATH")
181+
.cast<std::string>()
182+
.c_str());
183+
auto sys_path = py::module_::import("sys").attr("path").attr("__str__")().cast<std::string>();
184+
fprintf(stdout, "\nLOOOK_BEF %s\n", sys_path.c_str());
185+
fflush(stdout);
186+
py::module_::import("site").attr("main")(); // Ensure PYTHONPATH is processed.
187+
fprintf(stdout, "\nLOOOK_AFT %s\n", sys_path.c_str());
188+
fflush(stdout);
176189
REQUIRE(py::module_::import("widget_module").attr("add")(1, 2).cast<int>() == 3);
177190
REQUIRE(has_pybind11_internals_builtin());
178191
REQUIRE(has_pybind11_internals_static());

0 commit comments

Comments
 (0)