File indexing completed on 2025-01-18 10:17:51
0001
0002
0003
0004 #include <pybind11/embed.h>
0005
0006
0007
0008 PYBIND11_WARNING_DISABLE_MSVC(4996)
0009
0010
0011 #ifdef _
0012 # undef _
0013 #endif
0014
0015 #define CATCH_CONFIG_RUNNER
0016 #include <catch.hpp>
0017
0018 namespace py = pybind11;
0019
0020 int main(int argc, char *argv[]) {
0021
0022 std::string updated_pythonpath("pybind11_test_embed_PYTHONPATH_2099743835476552");
0023 const char *preexisting_pythonpath = getenv("PYTHONPATH");
0024 if (preexisting_pythonpath != nullptr) {
0025 #if defined(_WIN32)
0026 updated_pythonpath += ';';
0027 #else
0028 updated_pythonpath += ':';
0029 #endif
0030 updated_pythonpath += preexisting_pythonpath;
0031 }
0032 #if defined(_WIN32)
0033 _putenv_s("PYTHONPATH", updated_pythonpath.c_str());
0034 #else
0035 setenv("PYTHONPATH", updated_pythonpath.c_str(), 1);
0036 #endif
0037
0038 py::scoped_interpreter guard{};
0039
0040 auto result = Catch::Session().run(argc, argv);
0041
0042 return result < 0xff ? result : 0xff;
0043 }