This commit is contained in:
harisreedhar
2026-02-16 21:07:05 +05:30
committed by henryruhs
parent 02ba86308e
commit e16f5bca11
2 changed files with 8 additions and 18 deletions
-17
View File
@@ -28,23 +28,6 @@ def get_capabilities() -> Dict[str, Any]:
return ARGS_STORE.get('api')
def register_args(keys : List[str], scopes : List[Scope]) -> None:
for key in keys:
entry =\
{
'default': None,
'choices': None
}
for scope in scopes:
if scope == 'api':
ARGS_STORE['api'][key] = entry
if scope == 'cli':
ARGS_STORE['cli'][key] = entry
if scope == 'sys':
ARGS_STORE['sys'][key] = entry
def register_argument(action : Action, scopes : List[Scope]) -> None:
key = action.dest
choices : Any = list(action.choices) if action.choices else None
+8 -1
View File
@@ -1,4 +1,5 @@
import subprocess
from argparse import ArgumentParser
from typing import Iterator
import pytest
@@ -23,7 +24,13 @@ def before_all() -> None:
@pytest.fixture(scope = 'module')
def test_client() -> Iterator[TestClient]:
args_store.register_args([ 'source_paths', 'target_path', 'execution_providers' ], scopes = [ 'api' ])
program = ArgumentParser()
source_paths_action = program.add_argument('--source-paths', nargs = '+', default = None)
target_path_action = program.add_argument('--target-path', default = None)
execution_providers_action = program.add_argument('--execution-providers', nargs = '+', default = None)
args_store.register_argument(source_paths_action, scopes = [ 'api' ])
args_store.register_argument(target_path_action, scopes = [ 'api' ])
args_store.register_argument(execution_providers_action, scopes = [ 'api' ])
state_manager.init_item('execution_providers', [ 'cpu' ])
with TestClient(create_api()) as test_client: