-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* #43 prepared pytest-slc project * #43 Created pytest_slc project * Restored pytest-backend/noxconfig.py * #43 Added pytest-slc to the CD workflow * #43 set Python 3.10 in the github workflow * #43 set Python 3.10 in the github workflow * #43 Fixed wrong usage of connection parameters * #43 Fixed the test * #43 Fixed the test * #43 Fixed the test
- Loading branch information
Showing
17 changed files
with
2,879 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.html-documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# pytest-exasol-slc Plugin | ||
|
||
The `pytest-exasol-slc` plugin provides a pytest fixture for uploading a script language container | ||
into the database. The fixture is backend agnostic. It runs for the selected backends | ||
(see the documentation for the `pytest-exasol-backend` plugin). | ||
|
||
## Installation | ||
|
||
The pytest-exasol-slc plugin can be installed using pip: | ||
|
||
```shell | ||
pip install pytest-exasol-slc | ||
``` | ||
|
||
## Usage in Tests | ||
|
||
Below is an example of a test that requires a script language container to be uploaded into the database. | ||
Note, that by default this test will run twice - once for each backend. | ||
|
||
```python | ||
import pyexasol | ||
|
||
def test_something_with_slc(upload_slc, container_file_path, language_alias): | ||
|
||
upload_slc(container_file_path=container_file_path, language_alias=language_alias) | ||
|
||
# Now run the actual test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Changes | ||
|
||
* [unreleased](unreleased.md) | ||
* [0.1.0](changes_0.1.0.md) | ||
|
||
<!--- This MyST Parser Sphinx directive is necessary to keep Sphinx happy. We need list here all release letters again, because release droid and other scripts assume Markdown ---> | ||
```{toctree} | ||
--- | ||
hidden: | ||
--- | ||
unreleased | ||
changes_0.1.0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 0.1.0 - 2024-08-15 | ||
|
||
## Summary | ||
|
||
🚀 Initial Release of the pytest-exasol-slc Plugin | ||
|
||
## Feature | ||
|
||
* #37: Added the pytest-slc project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Unreleased |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from __future__ import annotations | ||
from typing import Callable | ||
from pathlib import Path | ||
import pytest | ||
|
||
import pyexasol | ||
import exasol.bucketfs as bfs | ||
from exasol.python_extension_common.deployment.language_container_deployer import LanguageContainerDeployer | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def upload_slc(backend_aware_database_params, | ||
backend_aware_bucketfs_params) -> Callable[[str | Path, str, str], None]: | ||
|
||
def func(container_file_path: str | Path, | ||
language_alias: str, | ||
bucketfs_path: str = ''): | ||
pyexasol_connection = pyexasol.connect(**backend_aware_database_params) | ||
bucketfs_path = bfs.path.build_path(**backend_aware_bucketfs_params, path=bucketfs_path) | ||
deployer = LanguageContainerDeployer(pyexasol_connection=pyexasol_connection, | ||
bucketfs_path=bucketfs_path, | ||
language_alias=language_alias) | ||
deployer.run(container_file=Path(container_file_path), alter_system=True, allow_override=True) | ||
|
||
return func |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# ATTENTION: | ||
# This file is generated by exasol/toolbox/pre_commit_hooks/package_version.py when using: | ||
# * either "poetry run nox -s fix" | ||
# * or "poetry run version-check <path/version.py> --fix" | ||
# Do not edit this file manually! | ||
# If you need to change the version, do so in the project.toml, e.g. by using `poetry version X.Y.Z`. | ||
MAJOR = 0 | ||
MINOR = 1 | ||
PATCH = 0 | ||
VERSION = f"{MAJOR}.{MINOR}.{PATCH}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Configuration for nox based task runner""" | ||
from __future__ import annotations | ||
|
||
from dataclasses import dataclass | ||
from pathlib import Path | ||
from typing import ( | ||
Any, | ||
Iterable, | ||
MutableMapping, | ||
) | ||
|
||
from nox import Session | ||
|
||
|
||
@dataclass(frozen=True) | ||
class Config: | ||
"""Project specific configuration used by nox infrastructure""" | ||
|
||
root: Path = Path(__file__).parent | ||
doc: Path = Path(__file__).parent / "doc" | ||
version_file: Path = Path(__file__).parent / "exasol" / "pytest_slc" / "version.py" | ||
path_filters: Iterable[str] = ("dist", ".eggs", "venv", "metrics-schema") | ||
|
||
@staticmethod | ||
def pre_integration_tests_hook( | ||
_session: Session, _config: Config, _context: MutableMapping[str, Any] | ||
) -> bool: | ||
"""Implement if project specific behaviour is required""" | ||
return True | ||
|
||
@staticmethod | ||
def post_integration_tests_hook( | ||
_session: Session, _config: Config, _context: MutableMapping[str, Any] | ||
) -> bool: | ||
"""Implement if project specific behaviour is required""" | ||
return True | ||
|
||
|
||
PROJECT_CONFIG = Config() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
"""defines nox tasks/targets for this project""" | ||
import sys | ||
|
||
import nox | ||
|
||
print(sys.path) | ||
# imports all nox task provided by the toolbox | ||
from exasol.toolbox.nox.tasks import * # pylint: disable=wildcard-import disable=unused-wildcard-import | ||
|
||
# default actions to be run if nothing is explicitly specified with the -s option | ||
nox.options.sessions = ["fix"] |
Oops, something went wrong.