Skip to content

Commit

Permalink
oss proto gen
Browse files Browse the repository at this point in the history
  • Loading branch information
qrort committed Feb 15, 2023
1 parent 43f8c0b commit 9d0be9d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Generated protos
*_pb2.py
*_pb2_grpc.py
*_pb2.pyi
3 changes: 2 additions & 1 deletion ydb/tests/functional/ydb_cli/test_ydb_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions ydb/tests/functional/ydb_cli/test_ydb_impex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -123,8 +123,7 @@ def run_import_parquet(self, data):
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)
Expand All @@ -143,7 +142,7 @@ def test_format_json(self):
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")
2 changes: 1 addition & 1 deletion ydb/tests/functional/ydb_cli/test_ydb_scripting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ydb/tests/functional/ydb_cli/test_ydb_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions ydb/tests/library/harness/kikimr_cluster_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
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)
Expand Down Expand Up @@ -171,7 +170,7 @@ def create_database(
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,
Expand Down
9 changes: 9 additions & 0 deletions ydb/tests/ydb_sdk_import/README.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 6 additions & 0 deletions ydb/tests/ydb_sdk_import/__init__.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9d0be9d

Please sign in to comment.