aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqrort <qrort@yandex-team.com>2023-02-15 17:37:11 +0300
committerqrort <qrort@yandex-team.com>2023-02-15 17:37:11 +0300
commit9d0be9d2699a3894d0fcf446eb7364164b3b3a71 (patch)
tree3730d0d9f8d5d75c374db13235c85f3b26b6252d
parent43f8c0b7c5ffc473bc7d12e19cce5c0f45bbd15d (diff)
downloadydb-9d0be9d2699a3894d0fcf446eb7364164b3b3a71.tar.gz
oss proto gen
-rw-r--r--.gitignore9
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_backup.py3
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_impex.py7
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_scripting.py2
-rw-r--r--ydb/tests/functional/ydb_cli/test_ydb_table.py2
-rw-r--r--ydb/tests/library/harness/kikimr_cluster_interface.py5
-rw-r--r--ydb/tests/ydb_sdk_import/README.md9
-rw-r--r--ydb/tests/ydb_sdk_import/__init__.py6
8 files changed, 33 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..6508f71cbf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# Generated protos
+*_pb2.py
+*_pb2_grpc.py
+*_pb2.pyi
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_backup.py b/ydb/tests/functional/ydb_cli/test_ydb_backup.py
index 75bc9cf328..c6d9b5872c 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_backup.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_backup.py
@@ -2,7 +2,8 @@
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
-import ydb
+from ydb.tests.ydb_sdk_import import ydb
+
from hamcrest import assert_that, is_, is_not, contains_inanyorder, has_item, has_items
import os
import logging
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_impex.py b/ydb/tests/functional/ydb_cli/test_ydb_impex.py
index ebf2707823..e602fde93a 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_impex.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_impex.py
@@ -2,9 +2,9 @@
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.oss_canonical import set_canondata_root
+from ydb.tests.ydb_sdk_import import ydb
import pytest
-import ydb
import logging
import pyarrow as pa
import pyarrow.parquet as pq
@@ -123,8 +123,7 @@ class TestImpex(BaseTestTableService):
self.clear_table()
with open("tempinput.parquet", "w"):
pq.write_table(data, "tempinput.parquet", version="2.4")
- output = self.execute_ydb_cli_command(["import", "file", "parquet", "-p", self.table_path, "-i", "tempinput.parquet"])
- return self.canonical_result(output)
+ self.execute_ydb_cli_command(["import", "file", "parquet", "-p", self.table_path, "-i", "tempinput.parquet"])
def run_export(self, format):
query = "SELECT `key`, `id`, `value` FROM `{}` ORDER BY `key`".format(self.table_path)
@@ -143,7 +142,7 @@ class TestImpex(BaseTestTableService):
self.run_import_json(DATA_JSON)
return self.run_export("json-unicode")
- @pytest.skip("test is failing right now")
+ @pytest.mark.skip("test is failing right now")
def test_format_parquet(self):
self.run_import_parquet(DATA_PARQUET)
return self.run_export("csv")
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_scripting.py b/ydb/tests/functional/ydb_cli/test_ydb_scripting.py
index 8d428920fb..c20572ac99 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_scripting.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_scripting.py
@@ -3,8 +3,8 @@
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.oss_canonical import set_canondata_root
+from ydb.tests.ydb_sdk_import import ydb
-import ydb
import os
import logging
diff --git a/ydb/tests/functional/ydb_cli/test_ydb_table.py b/ydb/tests/functional/ydb_cli/test_ydb_table.py
index e7533d2a73..0f6eb80225 100644
--- a/ydb/tests/functional/ydb_cli/test_ydb_table.py
+++ b/ydb/tests/functional/ydb_cli/test_ydb_table.py
@@ -3,8 +3,8 @@
from ydb.tests.library.common import yatest_common
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.oss_canonical import set_canondata_root
+from ydb.tests.ydb_sdk_import import ydb
-import ydb
import os
import logging
diff --git a/ydb/tests/library/harness/kikimr_cluster_interface.py b/ydb/tests/library/harness/kikimr_cluster_interface.py
index 1caf513af9..08a6f93dfd 100644
--- a/ydb/tests/library/harness/kikimr_cluster_interface.py
+++ b/ydb/tests/library/harness/kikimr_cluster_interface.py
@@ -11,8 +11,7 @@ from ydb.tests.library.common.protobuf_console import (
RemoveTenantRequest, GetOperationRequest)
import ydb.public.api.protos.ydb_cms_pb2 as cms_tenants_pb
from ydb.public.api.protos.ydb_status_codes_pb2 import StatusIds
-from ydb import issues
-
+from ydb.tests.ydb_sdk_import import ydb
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
@@ -171,7 +170,7 @@ class KiKiMRClusterInterface(object):
if not operation.ready:
operation = self.__wait_console_op(operation.id, timeout_seconds=timeout_seconds)
if operation.status != StatusIds.SUCCESS:
- raise RuntimeError('create_database failed: %s, %s' % (operation.status, issues._format_issues(operation.issues)))
+ raise RuntimeError('create_database failed: %s, %s' % (operation.status, ydb.issues._format_issues(operation.issues)))
self.__wait_tenant_up(
database_name,
diff --git a/ydb/tests/ydb_sdk_import/README.md b/ydb/tests/ydb_sdk_import/README.md
new file mode 100644
index 0000000000..a31e24384a
--- /dev/null
+++ b/ydb/tests/ydb_sdk_import/README.md
@@ -0,0 +1,9 @@
+# Why this file was created
+
+[YDB Python tests](https://github.com/ydb-platform/ydb/tree/main/ydb/tests) import and use symbols from [YDB Python SDK](https://github.com/ydb-platform/ydb-python-sdk) in their source code. YDB Python SDK is availible as pip package, but its sources are also [shipped with YDB](https://github.com/ydb-platform/ydb/tree/main/ydb/public/sdk/python/ydb), so, when the tests are run, the developer is sure that he or she is using the most recent version of SDK.
+
+When tests are run in YDB developers private infrastructure, some tweaks are applied, and SDK sources are put at top-level, so its symbols should be imported via `import ydb`.
+
+However, when sources are published in GitHub, they are not moved prior to tests launch and reside in *ydb/public/sdk/python/ydb*, so symbols should be imported via `from ydb.public.sdk.python import ydb`.
+
+We choose the type of the import based on environment variable value.
diff --git a/ydb/tests/ydb_sdk_import/__init__.py b/ydb/tests/ydb_sdk_import/__init__.py
new file mode 100644
index 0000000000..6aaa8211d3
--- /dev/null
+++ b/ydb/tests/ydb_sdk_import/__init__.py
@@ -0,0 +1,6 @@
+from ydb.tests.oss_canonical import is_oss
+
+if is_oss:
+ from ydb.public.sdk.python import ydb # noqa
+else:
+ import ydb # noqa