Skip to content

Commit

Permalink
Add debug fprintf to test_interpreter.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralf W. Grosse-Kunstleve committed Aug 5, 2022
1 parent 790e44e commit 0f9d2fa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_embed/test_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,19 @@ bool has_pybind11_internals_static() {

TEST_CASE("Restart the interpreter") {
// Verify pre-restart state.
fprintf(stdout,
"\nLOOOK PYTHONPATH %s\n",
py::module_::import("os")
.attr("environ")
.attr("get")("PYTHONPATH")
.cast<std::string>()
.c_str());
auto sys_path = py::module_::import("sys").attr("path").attr("__str__")().cast<std::string>();
fprintf(stdout, "\nLOOOK_BEF %s\n", sys_path.c_str());
fflush(stdout);
py::module_::import("site").attr("main")(); // Ensure PYTHONPATH is processed.
fprintf(stdout, "\nLOOOK_AFT %s\n", sys_path.c_str());
fflush(stdout);
REQUIRE(py::module_::import("widget_module").attr("add")(1, 2).cast<int>() == 3);
REQUIRE(has_pybind11_internals_builtin());
REQUIRE(has_pybind11_internals_static());
Expand Down

0 comments on commit 0f9d2fa

Please sign in to comment.