mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
Add C++ interface for the Python interpreter
This commit is contained in:
@@ -1,5 +1,16 @@
|
||||
// Catch provides the `int main()` function here. This is a standalone
|
||||
// The Catch implementation is compiled here. This is a standalone
|
||||
// translation unit to avoid recompiling it for every test change.
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <pybind11/embed.h>
|
||||
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include <catch.hpp>
|
||||
|
||||
namespace py = pybind11;
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
py::scoped_interpreter guard{};
|
||||
auto result = Catch::Session().run(argc, argv);
|
||||
|
||||
return result < 0xff ? result : 0xff;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user