diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/python/ut/lib | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/python/ut/lib')
-rw-r--r-- | contrib/libs/python/ut/lib/test.cpp | 21 | ||||
-rw-r--r-- | contrib/libs/python/ut/lib/test.h | 7 | ||||
-rw-r--r-- | contrib/libs/python/ut/lib/ya.make | 17 |
3 files changed, 45 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(); +} diff --git a/contrib/libs/python/ut/lib/test.h b/contrib/libs/python/ut/lib/test.h new file mode 100644 index 00000000000..1bf824ebea8 --- /dev/null +++ b/contrib/libs/python/ut/lib/test.h @@ -0,0 +1,7 @@ +#pragma once + +class TTestPyInvoker { +public: + TTestPyInvoker(); + const char* GetVersion(); +}; diff --git a/contrib/libs/python/ut/lib/ya.make b/contrib/libs/python/ut/lib/ya.make new file mode 100644 index 00000000000..cfa0aaa612f --- /dev/null +++ b/contrib/libs/python/ut/lib/ya.make @@ -0,0 +1,17 @@ +OWNER(spreis) + +PY23_LIBRARY() + +WITHOUT_LICENSE_TEXTS() + +LICENSE(YandexOpen) + +PEERDIR( + library/cpp/testing/unittest +) + +SRCS( + test.cpp +) + +END() |