Coverage for pystratum_cli/command/StratumCommand.py : 84%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from cleo.helpers import argument
3from pystratum_cli.command.BaseCommand import BaseCommand
6class StratumCommand(BaseCommand):
7 """
8 The stratum command: combination of constants, loader, and wrapper commands.
9 """
10 name = 'stratum'
11 description = 'Generates constants based on database IDs.'
12 arguments = [argument(name='config_file', description='The stratum configuration file.')]
14 # ------------------------------------------------------------------------------------------------------------------
15 def handle(self) -> int:
16 """
17 Executes constants command when StratumCommand is activated.
18 """
19 self._read_config_file()
21 factory = self._create_backend_factory()
23 worker = factory.create_constant_worker(self._config, self._io)
24 if worker:
25 ret = worker.execute()
27 if ret != 0: 27 ↛ 28line 27 didn't jump to line 28, because the condition on line 27 was never true
28 return ret
30 worker = factory.create_routine_loader_worker(self._config, self._io)
31 if worker:
32 ret = worker.execute()
34 if ret != 0: 34 ↛ 35line 34 didn't jump to line 35, because the condition on line 34 was never true
35 return ret
37 worker = factory.create_routine_wrapper_generator_worker(self._config, self._io)
38 if worker:
39 ret = worker.execute()
41 if ret != 0: 41 ↛ 42line 41 didn't jump to line 42, because the condition on line 41 was never true
42 return ret
44 self._io.write('')
46 return 0
48# ----------------------------------------------------------------------------------------------------------------------