Use argparser default for directory
Signed-off-by: Werner Lewis <werner.lewis@arm.com>
This commit is contained in:
parent
a16b617fe9
commit
f156c43702
1 changed files with 2 additions and 8 deletions
|
@ -126,13 +126,7 @@ class BaseTarget(metaclass=ABCMeta):
|
||||||
class TestGenerator:
|
class TestGenerator:
|
||||||
"""Generate test data."""
|
"""Generate test data."""
|
||||||
def __init__(self, options) -> None:
|
def __init__(self, options) -> None:
|
||||||
self.test_suite_directory = self.get_option(options, 'directory',
|
self.test_suite_directory = getattr(options, 'directory')
|
||||||
'tests/suites')
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_option(options, name: str, default: T) -> T:
|
|
||||||
value = getattr(options, name, None)
|
|
||||||
return default if value is None else value
|
|
||||||
|
|
||||||
def filename_for(self, basename: str) -> str:
|
def filename_for(self, basename: str) -> str:
|
||||||
"""The location of the data file with the specified base name."""
|
"""The location of the data file with the specified base name."""
|
||||||
|
@ -167,7 +161,7 @@ def main(args, generator_class: Type[TestGenerator] = TestGenerator):
|
||||||
help='List available targets and exit')
|
help='List available targets and exit')
|
||||||
parser.add_argument('--list-for-cmake', action='store_true',
|
parser.add_argument('--list-for-cmake', action='store_true',
|
||||||
help='Print \';\'-separated list of available targets and exit')
|
help='Print \';\'-separated list of available targets and exit')
|
||||||
parser.add_argument('--directory', metavar='DIR',
|
parser.add_argument('--directory', default="tests/suites", metavar='DIR',
|
||||||
help='Output directory (default: tests/suites)')
|
help='Output directory (default: tests/suites)')
|
||||||
parser.add_argument('targets', nargs='*', metavar='TARGET',
|
parser.add_argument('targets', nargs='*', metavar='TARGET',
|
||||||
help='Target file to generate (default: all; "-": none)')
|
help='Target file to generate (default: all; "-": none)')
|
||||||
|
|
Loading…
Reference in a new issue