Skip to content

Commit

Permalink
Renamed global fixtures from unit_tests/.../fixtures.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki committed Nov 4, 2024
1 parent 18c8d71 commit b31e48c
Show file tree
Hide file tree
Showing 6 changed files with 246 additions and 238 deletions.
38 changes: 19 additions & 19 deletions tests/unit_tests/query_handler/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@


@pytest.fixture
def prefix() -> str:
def tmp_db_obj_prefix() -> str:
return PREFIX


@pytest.fixture
def schema() -> str:
def aaf_pytest_db_schema() -> str:
return SCHEMA


class TestConnection(Connection):
class ConnectionMock(Connection):

@property
def name(self) -> str:
Expand All @@ -41,15 +41,15 @@ def password(self) -> str:


@pytest.fixture
def test_connection() -> Connection:
return TestConnection()
def connection_mock() -> Connection:
return ConnectionMock()


@pytest.fixture
def test_connection_lookup(test_connection) -> ConnectionLookup:
def mock_connection_lookup(connection_mock) -> ConnectionLookup:
def lookup(name: str) -> Connection:
if name == test_connection.name:
return test_connection
if name == connection_mock.name:
return connection_mock
else:
raise KeyError()

Expand All @@ -73,25 +73,25 @@ def mocked_temporary_bucketfs_location(tmp_path):


@pytest.fixture
def top_level_query_handler_context(
def top_level_query_handler_context_mock(
bucketfs_location: bfs.path.PathLike,
prefix: str,
schema: str,
test_connection_lookup: ConnectionLookup) -> TopLevelQueryHandlerContext:
tmp_db_obj_prefix: str,
aaf_pytest_db_schema: str,
mock_connection_lookup: ConnectionLookup) -> TopLevelQueryHandlerContext:
query_handler_context = TopLevelQueryHandlerContext(
temporary_bucketfs_location=bucketfs_location,
temporary_db_object_name_prefix=prefix,
connection_lookup=test_connection_lookup,
temporary_schema_name=schema
temporary_db_object_name_prefix=tmp_db_obj_prefix,
connection_lookup=mock_connection_lookup,
temporary_schema_name=aaf_pytest_db_schema,
)
return query_handler_context


@pytest.fixture(params=["top", "child"])
def scope_query_handler_context(
top_level_query_handler_context: TopLevelQueryHandlerContext,
def scope_query_handler_context_mock(
top_level_query_handler_context_mock: TopLevelQueryHandlerContext,
request) -> ScopeQueryHandlerContext:
if request.param == "top":
return top_level_query_handler_context
return top_level_query_handler_context_mock
else:
return top_level_query_handler_context.get_child_query_handler_context()
return top_level_query_handler_context_mock.get_child_query_handler_context()
Loading

0 comments on commit b31e48c

Please sign in to comment.