blob: b49d6ab61e63d2044c982bd82725c68b687f00a7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include "test.h"
#include <Python.h>
#include <library/cpp/testing/unittest/registar.h>
TTestPyInvoker::TTestPyInvoker() {}
const char* TTestPyInvoker::GetVersion() {
Py_Initialize();
auto* module = PyImport_ImportModule("sys");
UNIT_ASSERT(module != nullptr);
auto* versionObj = PyObject_GetAttrString(module, "version");
if (versionObj == nullptr) {
Py_DECREF(module);
UNIT_ASSERT(versionObj != nullptr);
}
return Py_GetVersion();
}
|