Skip to content

Commit

Permalink
tests/library/harness: py2 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
ijon committed Mar 6, 2025
1 parent 6178dac commit af7f26d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ydb/tests/library/harness/ydb_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,24 @@ def _ydb_database(cluster, database_path_base, unique_name):
with ydb_database_ctx(cluster, database):
yield database


@pytest.fixture(scope='function')
def ydb_database(ydb_cluster, ydb_root, ydb_safe_test_name):
yield from _ydb_database(ydb_cluster, ydb_root, ydb_safe_test_name)
# FIXME: PY2 syntax compatibility quirk: "yield from" emulation
# Can't use py3 syntax here cause there are nasty dependencies on
# tests/library/harness from some py2-only code in some other repositories
for i in _ydb_database(ydb_cluster, ydb_root, ydb_safe_test_name):
yield i


@pytest.fixture(scope='module')
def ydb_database_module_scope(ydb_cluster, ydb_root, request):
# make unique database name from the test module name, ensuring that
# it does not contains the dots
yield from _ydb_database(ydb_cluster, ydb_root, request.module.__name__.split('.')[-1])
unique_name = request.module.__name__.split('.')[-1]
# FIXME: PY2 syntax compatibility quirk: "yield from" emulation
for i in _ydb_database(ydb_cluster, ydb_root, unique_name):
yield i


@pytest.fixture(scope='module')
Expand Down

0 comments on commit af7f26d

Please sign in to comment.