Skip to content

Commit a111dc9

Browse files
authored
Merge pull request #6 from untergeek/docker_test/1.1.0
Lots of small changes:
2 parents fcdbf91 + 45dc5e1 commit a111dc9

File tree

8 files changed

+43
-7
lines changed

8 files changed

+43
-7
lines changed

docker_test/VERSION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version: 1.0.2
2-
Released: 23 August 2024
1+
Version: 1.1.0
2+
Released: 24 August 2024
33

44
# License and Changelog at https://github.com/untergeek/es-docker-test-scripts

docker_test/env_var.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
elasticsearch:
3+
client:
4+
hosts: ${ESCLIENT_HOSTS}
5+
ca_certs: ${ESCLIENT_CA_CERTS}
6+
other_settings:
7+
username: ${ESCLIENT_USERNAME}
8+
password: ${ESCLIENT_PASSWORD}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ cov = [
7676
'cov-report',
7777
]
7878

79-
[[tool.hatch.envs.all.matrix]]
79+
[[tool.hatch.envs.test.matrix]]
8080
python = ['3.8', '3.9', '3.10', '3.11', '3.12']
8181

8282
[tool.hatch.envs.test.scripts]

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
2-
log_cli=true
2+
log_cli=false
33
env_files =
44
.env
55
log_format = %(asctime)s %(levelname)-9s %(name)22s %(funcName)22s:%(lineno)-4d %(message)s

src/es_testbed/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Make classes easier to import here"""
22

3-
__version__ = '0.8.2'
3+
__version__ = '0.8.3'
44

55
from es_testbed._base import TestBed
66
from es_testbed._plan import PlanBuilder

src/es_testbed/defaults.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,20 @@
8080
TIMEOUT_DEFAULT: str = '30'
8181
TIMEOUT_ENVVAR: str = 'ES_TESTBED_TIMEOUT'
8282

83-
IlmPhase: t.TypeAlias = t.Dict[
83+
# Define IlmPhase as a typing alias to be reused multiple times
84+
#
85+
# In all currently supported Python versions (3.8 -> 3.12), the syntax:
86+
#
87+
# IlmPhase = t.Dict[
88+
#
89+
# is supported. In 3.10 and up, you can use the more explicit syntax:
90+
#
91+
# IlmPhase: t.TypeAlias = t.Dict[
92+
#
93+
# making use of the TypeAlias class.
94+
#
95+
# To support Python versions 3.8 and 3.9 (still), the older syntax is used.
96+
IlmPhase = t.Dict[
8497
str, t.Union[str, t.Dict[str, str], t.Dict[str, t.Dict[str, t.Dict[str, str]]]]
8598
]
8699

src/es_testbed/helpers/utils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,21 @@ def prettystr(*args, **kwargs) -> str:
163163
'Return the formatted representation of object as a string. indent, width, depth,
164164
compact, sort_dicts and underscore_numbers are passed to the PrettyPrinter
165165
constructor as formatting parameters' (from pprint documentation).
166+
167+
The keyword arg, ``underscore_numbers`` is only available in Python versions
168+
3.10 and up, so there is a test here to add it when that is the case.
166169
"""
167170
defaults = [
168171
('indent', 2),
169172
('width', 80),
170173
('depth', None),
171174
('compact', False),
172175
('sort_dicts', False),
173-
('underscore_numbers', False),
174176
]
177+
vinfo = python_version()
178+
if vinfo[0] == 3 and vinfo[1] >= 10:
179+
# underscore_numbers only works in 3.10 and up
180+
defaults.append(('underscore_numbers', False))
175181
kw = {}
176182
for tup in defaults:
177183
key, default = tup
@@ -225,6 +231,14 @@ def process_preset(
225231
return modpath, tmpdir
226232

227233

234+
def python_version() -> t.Tuple:
235+
"""
236+
Return running Python version tuple, e.g. 3.12.2 would be (3, 12, 2)
237+
"""
238+
_ = sys.version_info
239+
return (_[0], _[1], _[2])
240+
241+
228242
def raise_on_none(**kwargs):
229243
"""Raise if any kwargs have a None value"""
230244
for key, value in kwargs.items():

src/es_testbed/presets/searchable_test/definitions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def get_plan(scenario: str = None) -> dict:
2525
retval.update(buildlist())
2626
if not scenario:
2727
return retval
28+
retval['uniq'] = f'scenario-{scenario}'
2829
newvals = getattr(scenarios, scenario)
2930
ilm = {}
3031
if 'ilm' in newvals:

0 commit comments

Comments
 (0)