sigil-cli 1.3.0__tar.gz → 1.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sigil_cli-1.3.0/src/sigil_cli.egg-info → sigil_cli-1.4.1}/PKG-INFO +11 -6
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/README.md +10 -5
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/pyproject.toml +1 -1
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/__init__.py +2 -2
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/cli_tools/tree.py +3 -2
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/cli_tools/validate.py +3 -2
- sigil_cli-1.4.1/src/sigil/datasource/__init__.py +7 -0
- sigil_cli-1.4.1/src/sigil/datasource/datasource.py +21 -0
- sigil_cli-1.4.1/src/sigil/datasource/yml_source.py +36 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/entrypoint.py +5 -3
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/stages/__init__.py +5 -5
- sigil_cli-1.3.0/src/sigil/stages/yaml_reader.py → sigil_cli-1.4.1/src/sigil/stages/parser.py +14 -22
- {sigil_cli-1.3.0 → sigil_cli-1.4.1/src/sigil_cli.egg-info}/PKG-INFO +11 -6
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil_cli.egg-info/SOURCES.txt +4 -1
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_reader.py +7 -6
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/LICENSE +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/setup.cfg +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/__main__.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/cli_tools/__init__.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/cli_tools/init.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/models/__init__.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/models/argparser.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/models/argument.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/models/command.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/models/script.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/stages/builder.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/stages/resolver.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil/stages/script_loader.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil_cli.egg-info/dependency_links.txt +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil_cli.egg-info/entry_points.txt +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil_cli.egg-info/requires.txt +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/src/sigil_cli.egg-info/top_level.txt +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_builder.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_cli_init.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_cli_tree.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_cli_validate.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_integration.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_resolver.py +0 -0
- {sigil_cli-1.3.0 → sigil_cli-1.4.1}/tests/test_scriptloader.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sigil-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
4
4
|
Summary: Configuration driven CLI builder with subcommands and script loading
|
|
5
5
|
Author-email: Kenzo Staelens <kenzostael@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -278,7 +278,7 @@ Then run your script and hit <kbd>Tab</kbd> – subcommands and flags will compl
|
|
|
278
278
|
|
|
279
279
|
## Pluggable Backends
|
|
280
280
|
|
|
281
|
-
Sigil uses yaml by default, but you can supply any
|
|
281
|
+
Sigil uses yaml by default, but you can supply any datasource that we can convert it's output into `ParserConfig`:
|
|
282
282
|
|
|
283
283
|
```python
|
|
284
284
|
from sigil import run_from_config
|
|
@@ -286,15 +286,20 @@ from sigil import run_from_config
|
|
|
286
286
|
# Use JSON instead:
|
|
287
287
|
class JsonReader:
|
|
288
288
|
@classmethod
|
|
289
|
-
def
|
|
290
|
-
# read
|
|
289
|
+
def read_manifest(cls, config_root: Path) -> list | None:
|
|
290
|
+
# read target paths for loading configuration
|
|
291
291
|
...
|
|
292
|
+
|
|
293
|
+
def read_configuration(cls, target: Path) -> dict | None:
|
|
294
|
+
# read *.json, parse, convert to dict of raw data
|
|
295
|
+
...
|
|
296
|
+
|
|
292
297
|
|
|
293
|
-
run_from_config("/path/to/config",
|
|
298
|
+
run_from_config("/path/to/config", datasource=JsonReader)
|
|
294
299
|
```
|
|
295
300
|
|
|
296
301
|
You can also pass a pre‑loaded dictionary directly by wrapping it:
|
|
297
302
|
|
|
298
303
|
```python
|
|
299
|
-
run_from_config(my_dict,
|
|
304
|
+
run_from_config(my_dict, datasource=DictReader)
|
|
300
305
|
```
|
|
@@ -248,7 +248,7 @@ Then run your script and hit <kbd>Tab</kbd> – subcommands and flags will compl
|
|
|
248
248
|
|
|
249
249
|
## Pluggable Backends
|
|
250
250
|
|
|
251
|
-
Sigil uses yaml by default, but you can supply any
|
|
251
|
+
Sigil uses yaml by default, but you can supply any datasource that we can convert it's output into `ParserConfig`:
|
|
252
252
|
|
|
253
253
|
```python
|
|
254
254
|
from sigil import run_from_config
|
|
@@ -256,15 +256,20 @@ from sigil import run_from_config
|
|
|
256
256
|
# Use JSON instead:
|
|
257
257
|
class JsonReader:
|
|
258
258
|
@classmethod
|
|
259
|
-
def
|
|
260
|
-
# read
|
|
259
|
+
def read_manifest(cls, config_root: Path) -> list | None:
|
|
260
|
+
# read target paths for loading configuration
|
|
261
261
|
...
|
|
262
|
+
|
|
263
|
+
def read_configuration(cls, target: Path) -> dict | None:
|
|
264
|
+
# read *.json, parse, convert to dict of raw data
|
|
265
|
+
...
|
|
266
|
+
|
|
262
267
|
|
|
263
|
-
run_from_config("/path/to/config",
|
|
268
|
+
run_from_config("/path/to/config", datasource=JsonReader)
|
|
264
269
|
```
|
|
265
270
|
|
|
266
271
|
You can also pass a pre‑loaded dictionary directly by wrapping it:
|
|
267
272
|
|
|
268
273
|
```python
|
|
269
|
-
run_from_config(my_dict,
|
|
274
|
+
run_from_config(my_dict, datasource=DictReader)
|
|
270
275
|
```
|
|
@@ -12,9 +12,9 @@ from .models import (
|
|
|
12
12
|
)
|
|
13
13
|
from .stages import (
|
|
14
14
|
Builder,
|
|
15
|
+
Parser,
|
|
15
16
|
Resolver,
|
|
16
17
|
ScriptLoader,
|
|
17
|
-
YamlReader,
|
|
18
18
|
)
|
|
19
19
|
|
|
20
20
|
__all__ = (
|
|
@@ -24,7 +24,7 @@ __all__ = (
|
|
|
24
24
|
'LibArgParser',
|
|
25
25
|
'ParserConfig',
|
|
26
26
|
'SubcommandModule',
|
|
27
|
-
'
|
|
27
|
+
'Parser',
|
|
28
28
|
'Resolver',
|
|
29
29
|
'Builder',
|
|
30
30
|
'ScriptLoader',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
|
|
3
|
-
from sigil import Builder,
|
|
3
|
+
from sigil import Builder, Parser, Resolver
|
|
4
|
+
from sigil.datasource import YmlSource
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
# adapted from https://stackoverflow.com/questions/78166654/how-can-i-print-the-tree-structure-of-subparsers-of-an-argparse-parser-in-python/78246362#78246362
|
|
@@ -33,7 +34,7 @@ def parser_tree(
|
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
def display_project(projectroot):
|
|
36
|
-
raw =
|
|
37
|
+
raw = Parser(YmlSource).load(projectroot)
|
|
37
38
|
resolved = Resolver.resolve_inheritance(raw)
|
|
38
39
|
parser = Builder.build(resolved)
|
|
39
40
|
print(parser_tree(parser))
|
|
@@ -3,7 +3,8 @@ import logging
|
|
|
3
3
|
import sys
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
|
-
from sigil import Builder,
|
|
6
|
+
from sigil import Builder, Parser, Resolver
|
|
7
|
+
from sigil.datasource import YmlSource
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
# small helper to capture logs from in the guts of sigil
|
|
@@ -48,7 +49,7 @@ def _validate_project(projectroot):
|
|
|
48
49
|
_logger.error('missing manifest.yml, aborting.')
|
|
49
50
|
sys.exit(1)
|
|
50
51
|
|
|
51
|
-
raw =
|
|
52
|
+
raw = Parser(YmlSource).load(projectroot)
|
|
52
53
|
|
|
53
54
|
# these are easier for us to check
|
|
54
55
|
if 'root' not in raw:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
# currently network based datasources are not planned
|
|
6
|
+
# but if you do *need* one for some reason, feel free to make a PR
|
|
7
|
+
class DataSource(ABC):
|
|
8
|
+
@classmethod
|
|
9
|
+
@abstractmethod
|
|
10
|
+
def read_manifest(cls, target: Path) -> list | None:
|
|
11
|
+
# current implementation expects a list of files, or none on error
|
|
12
|
+
...
|
|
13
|
+
|
|
14
|
+
@classmethod
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def read_configuration(cls, target: Path) -> dict | None:
|
|
17
|
+
# raw data roughly mapping to internal models
|
|
18
|
+
# validation happens in a later stage
|
|
19
|
+
# datasources shouldn't need to validate
|
|
20
|
+
# for duplicates or malformed data
|
|
21
|
+
...
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import yaml
|
|
5
|
+
|
|
6
|
+
from .datasource import DataSource
|
|
7
|
+
|
|
8
|
+
_logger = logging.getLogger(__name__)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class YmlSource(DataSource):
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def read(cls, target):
|
|
15
|
+
try:
|
|
16
|
+
with open(target) as f:
|
|
17
|
+
return yaml.load(f.read(), Loader=yaml.SafeLoader)
|
|
18
|
+
except FileNotFoundError:
|
|
19
|
+
_logger.error(f"file '{target}' not found")
|
|
20
|
+
return
|
|
21
|
+
except yaml.error.YAMLError:
|
|
22
|
+
_logger.error(f"malformed yaml file ({target})")
|
|
23
|
+
return
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
def read_manifest(cls, manifest_file: Path) -> list | None:
|
|
28
|
+
# indirection? yes
|
|
29
|
+
# can new datasources implement a better manifest vs data? also yes
|
|
30
|
+
return cls.read(manifest_file)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def read_configuration(cls, target: Path) -> dict | None:
|
|
35
|
+
return cls.read(target)
|
|
36
|
+
|
|
@@ -2,14 +2,16 @@ import logging
|
|
|
2
2
|
import sys
|
|
3
3
|
from typing import Any
|
|
4
4
|
|
|
5
|
-
from .
|
|
5
|
+
from .datasource import DataSource, YmlSource
|
|
6
|
+
from .stages import Builder, Parser, Resolver, ScriptLoader
|
|
6
7
|
|
|
7
8
|
_logger = logging.getLogger(__name__)
|
|
8
9
|
|
|
9
10
|
# default to yamlloader, use whatever datastore you feel like
|
|
10
|
-
def run_from_config(config_root: str,
|
|
11
|
-
raw_data =
|
|
11
|
+
def run_from_config(config_root: str, datasource: type[DataSource] = YmlSource):
|
|
12
|
+
raw_data = Parser(datasource).load(config_root)
|
|
12
13
|
resolved = Resolver.resolve_inheritance(raw_data)
|
|
14
|
+
# parser beyond here is an argparser
|
|
13
15
|
parser = Builder.build(resolved)
|
|
14
16
|
|
|
15
17
|
execution_context = {}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
from .builder import Builder
|
|
2
|
+
from .parser import Parser
|
|
2
3
|
from .resolver import Resolver
|
|
3
4
|
from .script_loader import ScriptLoader
|
|
4
|
-
from .yaml_reader import YamlReader
|
|
5
5
|
|
|
6
6
|
__all__ = [
|
|
7
|
-
|
|
8
|
-
Resolver,
|
|
9
|
-
Builder,
|
|
10
|
-
ScriptLoader,
|
|
7
|
+
'Parser',
|
|
8
|
+
'Resolver',
|
|
9
|
+
'Builder',
|
|
10
|
+
'ScriptLoader',
|
|
11
11
|
]
|
sigil_cli-1.3.0/src/sigil/stages/yaml_reader.py → sigil_cli-1.4.1/src/sigil/stages/parser.py
RENAMED
|
@@ -3,15 +3,17 @@ import sys
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
from sigil.datasource import DataSource
|
|
8
7
|
from sigil.models import Argument, ParserConfig
|
|
9
8
|
|
|
10
9
|
_logger = logging.getLogger(__name__)
|
|
11
10
|
|
|
12
|
-
# This class converts raw data to dataclasses
|
|
13
|
-
#
|
|
14
|
-
class
|
|
11
|
+
# This class converts raw data to dataclasses
|
|
12
|
+
# it takes a datasource class to interface with any desired IO
|
|
13
|
+
class Parser:
|
|
14
|
+
def __init__(self, datasource: type[DataSource]):
|
|
15
|
+
self.datasource = datasource
|
|
16
|
+
|
|
15
17
|
@classmethod
|
|
16
18
|
def handle_duplicates(
|
|
17
19
|
cls,
|
|
@@ -24,21 +26,21 @@ class YamlReader:
|
|
|
24
26
|
for duplicate in duplicates:
|
|
25
27
|
_logger.warning(f"{entry}[{duplicate}] already defined, ignoring")
|
|
26
28
|
|
|
27
|
-
@classmethod
|
|
28
29
|
def load(
|
|
29
|
-
|
|
30
|
+
self,
|
|
30
31
|
config_root: str,
|
|
31
32
|
manifest_file='manifest.yml',
|
|
32
33
|
) -> dict[str, ParserConfig]:
|
|
33
34
|
config_root_path = Path(config_root)
|
|
34
|
-
|
|
35
|
+
|
|
36
|
+
manifest = self.datasource.read_manifest(config_root_path/manifest_file)
|
|
35
37
|
if not manifest:
|
|
36
38
|
_logger.critical("could not load manifest, aborting")
|
|
37
39
|
sys.exit(1)
|
|
38
40
|
loaded_config = {}
|
|
39
41
|
|
|
40
42
|
for entry in manifest:
|
|
41
|
-
loaded_entry =
|
|
43
|
+
loaded_entry = self.datasource.read_configuration(config_root_path/entry)
|
|
42
44
|
if not loaded_entry:
|
|
43
45
|
continue
|
|
44
46
|
tmp = {}
|
|
@@ -52,8 +54,8 @@ class YamlReader:
|
|
|
52
54
|
continue
|
|
53
55
|
tmp[k] = v # pesky can't del in for loop :/
|
|
54
56
|
loaded_entry = tmp
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
self.handle_duplicates(loaded_entry, loaded_config, entry)
|
|
58
|
+
self.convert_args(loaded_entry)
|
|
57
59
|
# override loaded entry duplicates by already found
|
|
58
60
|
loaded_config = loaded_entry | loaded_config
|
|
59
61
|
|
|
@@ -75,7 +77,7 @@ class YamlReader:
|
|
|
75
77
|
cls,
|
|
76
78
|
loaded_entry: dict[str, dict[str, Any]],
|
|
77
79
|
):
|
|
78
|
-
# while yes default factory this fixes the edge case where the key is defined
|
|
80
|
+
# while yes default factory; this fixes the edge case where the key is defined
|
|
79
81
|
# but without values
|
|
80
82
|
for command_def in loaded_entry.values():
|
|
81
83
|
args = command_def.get('args') or []
|
|
@@ -86,13 +88,3 @@ class YamlReader:
|
|
|
86
88
|
except Exception: # any failure is skipped
|
|
87
89
|
_logger.error(f'invalid argument definition,\n{arg}\nskipping')
|
|
88
90
|
command_def['args'] = build_args
|
|
89
|
-
|
|
90
|
-
# actual IO, also adaptable
|
|
91
|
-
@classmethod
|
|
92
|
-
def read_file(cls, filename) -> dict | None:
|
|
93
|
-
try:
|
|
94
|
-
with open(filename) as f:
|
|
95
|
-
return yaml.load(f.read(), Loader=yaml.SafeLoader)
|
|
96
|
-
except FileNotFoundError:
|
|
97
|
-
_logger.error(f'failed to load file {filename}, skipping')
|
|
98
|
-
return
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sigil-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.1
|
|
4
4
|
Summary: Configuration driven CLI builder with subcommands and script loading
|
|
5
5
|
Author-email: Kenzo Staelens <kenzostael@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -278,7 +278,7 @@ Then run your script and hit <kbd>Tab</kbd> – subcommands and flags will compl
|
|
|
278
278
|
|
|
279
279
|
## Pluggable Backends
|
|
280
280
|
|
|
281
|
-
Sigil uses yaml by default, but you can supply any
|
|
281
|
+
Sigil uses yaml by default, but you can supply any datasource that we can convert it's output into `ParserConfig`:
|
|
282
282
|
|
|
283
283
|
```python
|
|
284
284
|
from sigil import run_from_config
|
|
@@ -286,15 +286,20 @@ from sigil import run_from_config
|
|
|
286
286
|
# Use JSON instead:
|
|
287
287
|
class JsonReader:
|
|
288
288
|
@classmethod
|
|
289
|
-
def
|
|
290
|
-
# read
|
|
289
|
+
def read_manifest(cls, config_root: Path) -> list | None:
|
|
290
|
+
# read target paths for loading configuration
|
|
291
291
|
...
|
|
292
|
+
|
|
293
|
+
def read_configuration(cls, target: Path) -> dict | None:
|
|
294
|
+
# read *.json, parse, convert to dict of raw data
|
|
295
|
+
...
|
|
296
|
+
|
|
292
297
|
|
|
293
|
-
run_from_config("/path/to/config",
|
|
298
|
+
run_from_config("/path/to/config", datasource=JsonReader)
|
|
294
299
|
```
|
|
295
300
|
|
|
296
301
|
You can also pass a pre‑loaded dictionary directly by wrapping it:
|
|
297
302
|
|
|
298
303
|
```python
|
|
299
|
-
run_from_config(my_dict,
|
|
304
|
+
run_from_config(my_dict, datasource=DictReader)
|
|
300
305
|
```
|
|
@@ -8,6 +8,9 @@ src/sigil/cli_tools/__init__.py
|
|
|
8
8
|
src/sigil/cli_tools/init.py
|
|
9
9
|
src/sigil/cli_tools/tree.py
|
|
10
10
|
src/sigil/cli_tools/validate.py
|
|
11
|
+
src/sigil/datasource/__init__.py
|
|
12
|
+
src/sigil/datasource/datasource.py
|
|
13
|
+
src/sigil/datasource/yml_source.py
|
|
11
14
|
src/sigil/models/__init__.py
|
|
12
15
|
src/sigil/models/argparser.py
|
|
13
16
|
src/sigil/models/argument.py
|
|
@@ -15,9 +18,9 @@ src/sigil/models/command.py
|
|
|
15
18
|
src/sigil/models/script.py
|
|
16
19
|
src/sigil/stages/__init__.py
|
|
17
20
|
src/sigil/stages/builder.py
|
|
21
|
+
src/sigil/stages/parser.py
|
|
18
22
|
src/sigil/stages/resolver.py
|
|
19
23
|
src/sigil/stages/script_loader.py
|
|
20
|
-
src/sigil/stages/yaml_reader.py
|
|
21
24
|
src/sigil_cli.egg-info/PKG-INFO
|
|
22
25
|
src/sigil_cli.egg-info/SOURCES.txt
|
|
23
26
|
src/sigil_cli.egg-info/dependency_links.txt
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import yaml
|
|
2
2
|
|
|
3
|
-
from sigil import
|
|
3
|
+
from sigil import Parser, ParserConfig
|
|
4
|
+
from sigil.datasource import YmlSource
|
|
4
5
|
from sigil.models.command import UNSUPPORTED_KWARGS
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
def test_yaml_reader_load(tmp_path, sample_manifest):
|
|
8
|
-
"""Test that
|
|
9
|
+
"""Test that Parser(YmlSource).load reads all YAML files and converts args."""
|
|
9
10
|
config_root = sample_manifest
|
|
10
|
-
loaded =
|
|
11
|
+
loaded = Parser(YmlSource).load(config_root)
|
|
11
12
|
|
|
12
13
|
assert "root" in loaded
|
|
13
14
|
assert "sub" in loaded
|
|
@@ -40,7 +41,7 @@ def test_yaml_reader_duplicate_warning(caplog, tmp_path):
|
|
|
40
41
|
(tmp_path / "b.yml").write_text(yaml.dump(b_data))
|
|
41
42
|
|
|
42
43
|
with caplog.at_level("WARNING"):
|
|
43
|
-
loaded =
|
|
44
|
+
loaded = Parser(YmlSource).load(tmp_path)
|
|
44
45
|
|
|
45
46
|
assert "[cmd] already defined" in caplog.text
|
|
46
47
|
assert loaded["cmd"].help == "from a" # first wins
|
|
@@ -63,7 +64,7 @@ def test_yaml_reader_invalid_arg(caplog, tmp_path):
|
|
|
63
64
|
(tmp_path / "cmd.yml").write_text(yaml.dump(cmd_data))
|
|
64
65
|
|
|
65
66
|
with caplog.at_level("ERROR"):
|
|
66
|
-
loaded =
|
|
67
|
+
loaded = Parser(YmlSource).load(tmp_path)
|
|
67
68
|
|
|
68
69
|
assert "invalid argument definition" in caplog.text
|
|
69
70
|
assert len(loaded["cmd"].args) == 1
|
|
@@ -85,7 +86,7 @@ def test_invalid_parser(caplog, tmp_path):
|
|
|
85
86
|
(tmp_path / "cmd.yml").write_text(yaml.dump(cmd_data))
|
|
86
87
|
|
|
87
88
|
with caplog.at_level("WARNING"):
|
|
88
|
-
|
|
89
|
+
Parser(YmlSource).load(tmp_path)
|
|
89
90
|
|
|
90
91
|
for kw in UNSUPPORTED_KWARGS:
|
|
91
92
|
assert f"'{kw}' unsupported" in caplog.text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|