Skip to content

Commit d3133ff

Browse files
committed
Hatch conf and test correction
1 parent 1364467 commit d3133ff

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ dependencies = [
5757
[tool.hatch.envs.hatch-test]
5858
extra-args = ["-vv"]
5959
dependencies = [
60+
"coverage[toml]>=6.5",
61+
"pytest",
6062
]
6163

6264
[[tool.hatch.envs.hatch-test.matrix]]

tests/config/test_cfg_list.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class SimpleEnum(IntEnum):
6464
READY = 1
6565
RUNNING = 2
6666

67-
class TestParamBase:
67+
class ParamBase:
6868
"""Base class for test parameter sets."""
6969
# Values used in tests
7070
DEFAULT_VAL = []
@@ -118,7 +118,7 @@ def _format_item(self, item) -> str:
118118

119119
# --- Parameter Sets for Different List Item Types ---
120120

121-
class StrParams(TestParamBase):
121+
class StrParams(ParamBase):
122122
"""Parameters for ListOption[str]."""
123123
DEFAULT_VAL = ["DEFAULT_value"]
124124
PRESENT_VAL = ["present_value_1", "present_value_2"]
@@ -148,7 +148,7 @@ class StrParams(TestParamBase):
148148
option_name =
149149
"""
150150

151-
class IntParams(TestParamBase):
151+
class IntParams(ParamBase):
152152
"""Parameters for ListOption[int]."""
153153
DEFAULT_VAL = [0]
154154
PRESENT_VAL = [10, 20]
@@ -177,7 +177,7 @@ class IntParams(TestParamBase):
177177
option_name =
178178
"""
179179

180-
class FloatParams(TestParamBase):
180+
class FloatParams(ParamBase):
181181
"""Parameters for ListOption[float]."""
182182
DEFAULT_VAL = [0.0]
183183
PRESENT_VAL = [10.1, 20.2]
@@ -206,7 +206,7 @@ class FloatParams(TestParamBase):
206206
option_name =
207207
"""
208208

209-
class DecimalParams(TestParamBase):
209+
class DecimalParams(ParamBase):
210210
"""Parameters for ListOption[Decimal]."""
211211
DEFAULT_VAL = [Decimal("0.0")]
212212
PRESENT_VAL = [Decimal("10.1"), Decimal("20.2")]
@@ -235,7 +235,7 @@ class DecimalParams(TestParamBase):
235235
option_name =
236236
"""
237237

238-
class BoolParams(TestParamBase):
238+
class BoolParams(ParamBase):
239239
"""Parameters for ListOption[bool]."""
240240
DEFAULT_VAL = [False] # From "0"
241241
PRESENT_VAL = [True, False]
@@ -264,7 +264,7 @@ class BoolParams(TestParamBase):
264264
option_name =
265265
"""
266266

267-
class UUIDParams(TestParamBase):
267+
class UUIDParams(ParamBase):
268268
"""Parameters for ListOption[UUID]."""
269269
DEFAULT_VAL = [UUID("eeb7f94a-256d-11ea-ad1d-5404a6a1fd6e")]
270270
PRESENT_VAL = [UUID("0a7fd53a-256e-11ea-ad1d-5404a6a1fd6e"),
@@ -297,7 +297,7 @@ class UUIDParams(TestParamBase):
297297
option_name =
298298
"""
299299

300-
class MIMEParams(TestParamBase):
300+
class MIMEParams(ParamBase):
301301
"""Parameters for ListOption[MIME]."""
302302
DEFAULT_VAL = [MIME("application/octet-stream")]
303303
PRESENT_VAL = [MIME("text/plain;charset=utf-8"), MIME("text/csv")]
@@ -328,7 +328,7 @@ class MIMEParams(TestParamBase):
328328
option_name =
329329
"""
330330

331-
class ZMQAddressParams(TestParamBase):
331+
class ZMQAddressParams(ParamBase):
332332
"""Parameters for ListOption[ZMQAddress]."""
333333
DEFAULT_VAL = [ZMQAddress("tcp://127.0.0.1:*")]
334334
PRESENT_VAL = [ZMQAddress("ipc://@my-address"), ZMQAddress("inproc://my-address"), ZMQAddress("tcp://127.0.0.1:9001")]
@@ -357,7 +357,7 @@ class ZMQAddressParams(TestParamBase):
357357
option_name =
358358
"""
359359

360-
class MultiTypeParams(TestParamBase):
360+
class MultiTypeParams(ParamBase):
361361
"""Parameters for ListOption with multiple item types."""
362362
DEFAULT_VAL = ["DEFAULT_value"] # From str:DEFAULT_value
363363
PRESENT_VAL = [1, 1.1, Decimal("1.01"), True,
@@ -413,7 +413,7 @@ class MultiTypeParams(TestParamBase):
413413
MIMEParams, ZMQAddressParams, MultiTypeParams]
414414

415415
@pytest.fixture(params=params)
416-
def test_params(base_conf: ConfigParser, request) -> TestParamBase:
416+
def test_params(base_conf: ConfigParser, request) -> ParamBase:
417417
"""Fixture providing parameterized test data for ListOption tests."""
418418
param_class = request.param
419419
data = param_class()
@@ -425,7 +425,7 @@ def test_params(base_conf: ConfigParser, request) -> TestParamBase:
425425

426426
# --- Test Cases ---
427427

428-
def test_simple(test_params: TestParamBase):
428+
def test_simple(test_params: ParamBase):
429429
"""Tests basic ListOption: init, load, value access, clear, default handling."""
430430
opt = config.ListOption("option_name", test_params.ITEM_TYPE, "description")
431431

@@ -479,7 +479,7 @@ def test_simple(test_params: TestParamBase):
479479
opt.value = [test_params.NEW_VAL[0], 123] # Assign int to str list
480480

481481

482-
def test_required(test_params: TestParamBase):
482+
def test_required(test_params: ParamBase):
483483
"""Tests ListOption with the 'required' flag."""
484484
opt = config.ListOption("option_name", test_params.ITEM_TYPE, "description", required=True)
485485

@@ -511,7 +511,7 @@ def test_required(test_params: TestParamBase):
511511
assert opt.value == test_params.NEW_VAL
512512
opt.validate()
513513

514-
def test_bad_value(test_params: TestParamBase):
514+
def test_bad_value(test_params: ParamBase):
515515
"""Tests loading invalid list string values."""
516516
opt = config.ListOption("option_name", test_params.ITEM_TYPE, "description")
517517

@@ -552,7 +552,7 @@ def test_bad_value(test_params: TestParamBase):
552552
assert excinfo.value.args == test_params.BAD_MSG
553553

554554

555-
def test_default(test_params: TestParamBase):
555+
def test_default(test_params: ParamBase):
556556
"""Tests ListOption with a defined default list value."""
557557
opt = config.ListOption("option_name", test_params.ITEM_TYPE, "description",
558558
default=test_params.DEFAULT_OPT_VAL)
@@ -591,7 +591,7 @@ def test_default(test_params: TestParamBase):
591591
opt.value.append(test_params.DEFAULT_VAL[0]) # Modify the current value list
592592
assert opt.default == test_params.DEFAULT_OPT_VAL # Original default should be unchanged
593593

594-
def test_proto(test_params: TestParamBase, proto: ConfigProto):
594+
def test_proto(test_params: ParamBase, proto: ConfigProto):
595595
"""Tests serialization to and deserialization from Protobuf messages."""
596596
opt = config.ListOption("option_name", test_params.ITEM_TYPE, "description",
597597
default=test_params.DEFAULT_OPT_VAL)
@@ -650,7 +650,7 @@ def test_proto(test_params: TestParamBase, proto: ConfigProto):
650650
assert excinfo.value.args == test_params.BAD_MSG
651651

652652

653-
def test_get_config(test_params: TestParamBase):
653+
def test_get_config(test_params: ParamBase):
654654
"""Tests the get_config method for generating config file string representation."""
655655
opt = config.ListOption("option_name", test_params.ITEM_TYPE, "description",
656656
default=test_params.DEFAULT_OPT_VAL)
@@ -694,7 +694,7 @@ def test_get_config(test_params: TestParamBase):
694694
opt.set_value(None)
695695
assert opt.get_config(plain=True) == "option_name = <UNDEFINED>\n"
696696

697-
def test_separator_override(test_params: TestParamBase):
697+
def test_separator_override(test_params: ParamBase):
698698
"""Tests ListOption with an explicit separator."""
699699
# Use semicolon as separator
700700
opt = config.ListOption("option_name", test_params.ITEM_TYPE, "description",

0 commit comments

Comments
 (0)