-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathnoxconfig.py
More file actions
93 lines (74 loc) · 2.57 KB
/
noxconfig.py
File metadata and controls
93 lines (74 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from __future__ import annotations
from pathlib import Path
from exasol.toolbox.config import BaseConfig
from exasol.toolbox.nox.plugin import hookimpl
from nox import Session
from pydantic import (
computed_field,
)
DEFAULT_PORT = 8563
DEFAULT_DB_VERSION = "8.29.6"
CONTAINER_SUFFIX = "test"
CONTAINER_NAME = f"db_container_{CONTAINER_SUFFIX}"
def start_test_db(
session: Session,
port: int = DEFAULT_PORT,
db_version: str = DEFAULT_DB_VERSION,
with_certificate: bool = True,
) -> None:
# For Docker in a VM setup, refer to the ``doc/user_guide/developer_guide.rst``
command = [
"itde",
"spawn-test-environment",
"--environment-name",
CONTAINER_SUFFIX,
"--database-port-forward",
f"{port}",
"--bucketfs-port-forward",
"2580",
"--docker-db-image-version",
db_version,
"--db-mem-size",
"4GB",
]
if with_certificate:
command.append(
"--create-certificates",
)
session.run(*command, external=True)
def stop_test_db(session: Session) -> None:
session.run("docker", "kill", CONTAINER_NAME, external=True)
class StartDB:
@hookimpl
def pre_integration_tests_hook(self, session, config, context):
port = context.get("port", DEFAULT_PORT)
db_version = context.get("db_version", DEFAULT_DB_VERSION)
start_test_db(session=session, port=port, db_version=db_version)
class StopDB:
@hookimpl
def post_integration_tests_hook(self, session, config, context):
stop_test_db(session=session)
class Config(BaseConfig):
@computed_field # type: ignore[misc]
@property
def source_code_path(self) -> Path:
"""
Path to the source code of the project.
In pyexasol, this needs to be overridden due to a custom directory setup.
This will be addressed in:
https://github.com/exasol/pyexasol/issues/295
"""
return self.root_path / self.project_name
PROJECT_CONFIG = Config(
root_path=Path(__file__).parent,
project_name="pyexasol",
plugins_for_nox_sessions=(StartDB, StopDB),
# Python 3.14 is left out due to issues installing pyarrow
# & a known issue in the ITDE & will be resolved in:
# https://github.com/exasol/pyexasol/issues/285
python_versions=("3.10", "3.11", "3.12", "3.13"),
# Changes for 7.x and 2025.1.x have not yet been made. 7.x works for all tests,
# except for the examples/UDFs. These will be resolved in:
# https://github.com/exasol/pyexasol/issues/273
exasol_versions=("8.29.13",),
)