MCPcopy Create free account
hub / github.com/pybind/pybind11 / main

Function main

tests/test_with_catch/catch.cpp:142–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140} // namespace
141
142int main(int argc, char *argv[]) {
143#ifndef _WIN32
144 std::signal(SIGTERM, termination_signal_handler);
145#endif
146
147 // Setup for TEST_CASE in test_interpreter.cpp, tagging on a large random number:
148 std::string updated_pythonpath("pybind11_test_with_catch_PYTHONPATH_2099743835476552");
149 const char *preexisting_pythonpath = getenv("PYTHONPATH");
150 if (preexisting_pythonpath != nullptr) {
151#if defined(_WIN32)
152 updated_pythonpath += ';';
153#else
154 updated_pythonpath += ':';
155#endif
156 updated_pythonpath += preexisting_pythonpath;
157 }
158#if defined(_WIN32)
159 _putenv_s("PYTHONPATH", updated_pythonpath.c_str());
160#else
161 setenv("PYTHONPATH", updated_pythonpath.c_str(), /*replace=*/1);
162#endif
163
164 std::cout << "[ STARTING ] " << get_utc_timestamp() << '\n';
165 std::cout.flush();
166
167 py::scoped_interpreter guard{};
168
169 auto result = Catch::Session().run(argc, argv);
170
171 std::cout << "[ DONE ] " << get_utc_timestamp() << " (result " << result << ")\n";
172 std::cout.flush();
173
174 return result < 0xff ? result : 0xff;
175}

Callers 1

Calls 2

get_utc_timestampFunction · 0.85
runMethod · 0.45

Tested by

no test coverage detected