-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#58 Made the pytest-slc plugin using the pyexasol_connection #59
Changes from 3 commits
d72ddc2
a68a312
4854404
f442c8c
fee95ac
6c8238e
a3ec49a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 0.3.0 - 2024-09-20 | ||
|
||
## Summary | ||
|
||
🚀 Starting with this release `pytest-exasol-slc` connects to the database using a fixture from `pytest-exasol-extension`. | ||
|
||
## Bug fixes | ||
|
||
* #58: Used the `pyexasol_connection` fixture from the `pytest-exasol-extension`. |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "pytest-exasol-slc" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
description = "" | ||
authors = ["Mikhail Beck <[email protected]>"] | ||
readme = "README.md" | ||
|
@@ -9,8 +9,9 @@ packages = [{include = "exasol"}] | |
[tool.poetry.dependencies] | ||
python = ">=3.10,<4" | ||
pytest = ">=7,<9" | ||
pytest-exasol-backend = ">=0.2.0" | ||
exasol-python-extension-common = ">=0.4.0" | ||
pytest-exasol-backend = ">=0.3.0" | ||
pytest-exasol-extension = ">=0.1.0" | ||
exasol-python-extension-common = ">=0.5.0" | ||
|
||
[tool.poetry.plugins.pytest11] | ||
slc = "exasol.pytest_slc" | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,18 +4,18 @@ | |||||
|
||||||
pytest_plugins = ["pytester"] | ||||||
|
||||||
LANGUAGE_ALIAS = 'PYTHON3_PYTEST_SLC' | ||||||
|
||||||
_test_code = dedent(fr""" | ||||||
import pyexasol | ||||||
import pytest | ||||||
from exasol.python_extension_common.deployment.language_container_validator import temp_schema | ||||||
from exasol.python_extension_common.deployment.language_container_builder import ( | ||||||
LanguageContainerBuilder, find_path_backwards) | ||||||
|
||||||
LANGUAGE_ALIAS = 'PYTHON3_PYTEST_SLC' | ||||||
|
||||||
@pytest.fixture(scope='session') | ||||||
def slc_builder() -> LanguageContainerBuilder: | ||||||
with LanguageContainerBuilder('test_container', LANGUAGE_ALIAS) as container_builder: | ||||||
with LanguageContainerBuilder('test_container') as container_builder: | ||||||
project_directory = find_path_backwards("pyproject.toml", "{__file__}").parent | ||||||
container_builder.prepare_flavor(project_directory) | ||||||
yield container_builder | ||||||
|
@@ -24,7 +24,7 @@ def assert_udf_running(conn: pyexasol.ExaConnection): | |||||
with temp_schema(conn) as schema: | ||||||
udf_name = 'TEST_UDF' | ||||||
udf_create_sql = ( | ||||||
f'CREATE OR REPLACE {{LANGUAGE_ALIAS}} SCALAR SCRIPT "{{schema}}"."{{udf_name}}"() ' | ||||||
f'CREATE OR REPLACE {LANGUAGE_ALIAS} SCALAR SCRIPT "{{schema}}"."{{udf_name}}"() ' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not 100% sure, but shouldn't all parameters be enclosed only in single braces to allow f-string substitution?
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a piece of code, which itself uses f-strings. This is the case for the |
||||||
'RETURNS BOOLEAN AS ' | ||||||
'def run(ctx): ' | ||||||
'return True ' | ||||||
|
@@ -35,6 +35,7 @@ def assert_udf_running(conn: pyexasol.ExaConnection): | |||||
assert result[0][0] is True | ||||||
ckunki marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
def test_upload_slc(upload_slc, backend_aware_database_params): | ||||||
upload_slc("{LANGUAGE_ALIAS}") | ||||||
assert_udf_running(pyexasol.connect(**backend_aware_database_params)) | ||||||
""") | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, you changed it to that, such that we can isolate the aliases per test, if it necessary. I could assume, in case of the deployer tests and the extension tests that could be necessary. Or, did you think of a different reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the motivation is described in the related ticket #58:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I have some more questions:
func
use thelanguage_alias
that is already known to theslc_builder
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My question was related to the function and not the Pyexasol connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We used to take the language_alias from the LanguageContainerBuilder. As we found, the language_alias is not actually required to build a language container; it is only for testing it, which we don't do. So it was removed from the LanguageContainerBuilder. But we do need it for the container deployer. Hence is the
upload_slc
function. We can provide thelanguage_alias
there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But good point , maybe we need a fixture that returns a function that activates the SLC for a connection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - very good, thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decision: