Skip to content

Commit

Permalink
Merge branch 'main' into refactoring/#203_Clean_package_names_and_dir…
Browse files Browse the repository at this point in the history
…ectory_structure
  • Loading branch information
ckunki committed Nov 7, 2024
2 parents ad0dc33 + d86ebb0 commit 01b86dc
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 238 deletions.
1 change: 1 addition & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Changelog

* [0.1.1](changes_0.1.1.md)
* [0.1.0](changes_0.1.0.md)
14 changes: 14 additions & 0 deletions doc/changes/changes_0.1.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# advanced-analytics-framework 0.1.1, released ????-??-??

Code name:

## Summary

## Bugfixes

* #206: Fixed download URL of SLC from GitHub releases

## Refactorings

* #188: Renamed global pytest fixtures to avoid name clashes
* #208: Replaced access to private attribute by public
2 changes: 1 addition & 1 deletion doc/user_guide/example-udf-script/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class ExampleQueryHandler(UDFQueryHandler):
return f"{timestamp} {key} {self.parameter}"

def table_query_string(statement: str, **kwargs):
table_name = self.db_table_proxy._db_object_name.fully_qualified
table_name = self.db_table_proxy.fully_qualified
return statement.format(table_name=table_name, **kwargs)

def table_query(statement: str, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion exasol/analytics/slc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
LANGUAGE_ALIAS = "PYTHON3_AAF"
SLC_NAME = "exasol_advanced_analytics_framework_container"
SLC_FILE_NAME = SLC_NAME + "_release.tar.gz"
SLC_URL_FORMATTER = "https://github.com/exasol/advanced_analytics_framework/releases/download/{version}/" + SLC_FILE_NAME
SLC_URL_FORMATTER = "https://github.com/exasol/advanced-analytics-framework/releases/download/{version}/" + SLC_FILE_NAME


@contextmanager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@


@pytest.fixture(scope="session")
def db_schema_name() -> str:
def itest_db_schema() -> str:
"""
Overrides default fixture from pytest-exasol-extension.
"""
return "TEST_INTEGRATION"


@pytest.fixture(scope="module")
def deployed_scripts(pyexasol_connection, db_schema_name, language_alias) -> None:
def deployed_scripts(pyexasol_connection, itest_db_schema, language_alias) -> None:
save_aaf_query_loop_lua_script()
ScriptsDeployer(
language_alias,
db_schema_name,
itest_db_schema,
pyexasol_connection,
).deploy_scripts()


@pytest.fixture(scope="module")
def database_with_slc(
deployed_scripts,
db_schema_name,
itest_db_schema,
bucketfs_connection_factory,
deployed_slc,
) -> Tuple[str, str]:
bucketfs_connection_factory(BUCKETFS_CONNECTION_NAME, "my-folder")
return BUCKETFS_CONNECTION_NAME, db_schema_name
return BUCKETFS_CONNECTION_NAME, itest_db_schema
44 changes: 22 additions & 22 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 connection_lookup_mock(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 @@ -62,7 +62,7 @@ def sample_mounted_bucket(tmp_path):


@pytest.fixture
def bucketfs_location(sample_mounted_bucket):
def sample_bucketfs_location(sample_mounted_bucket):
return bfs.path.BucketPath("a/b", sample_mounted_bucket)


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


@pytest.fixture
def top_level_query_handler_context(
bucketfs_location: bfs.path.PathLike,
prefix: str,
schema: str,
test_connection_lookup: ConnectionLookup) -> TopLevelQueryHandlerContext:
def top_level_query_handler_context_mock(
sample_bucketfs_location: bfs.path.PathLike,
tmp_db_obj_prefix: str,
aaf_pytest_db_schema: str,
connection_lookup_mock: 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_bucketfs_location=sample_bucketfs_location,
temporary_db_object_name_prefix=tmp_db_obj_prefix,
connection_lookup=connection_lookup_mock,
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 01b86dc

Please sign in to comment.