summaryrefslogtreecommitdiffstats
path: root/contrib/libs/python/ut/lib/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libs/python/ut/lib/test.cpp')
-rw-r--r--contrib/libs/python/ut/lib/test.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/contrib/libs/python/ut/lib/test.cpp b/contrib/libs/python/ut/lib/test.cpp
new file mode 100644
index 00000000000..e3aabc8889f
--- /dev/null
+++ b/contrib/libs/python/ut/lib/test.cpp
@@ -0,0 +1,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();
+}