else:
click.echo("No testsuite defined yet in dovetail!!!")
- def show_testcase(self, testcase):
- abs_testcase_path = constants.TESTCASE_PATH
- if testcase.startswith("dovetail."):
- testcase_yml = testcase[9:] + '.yml'
+ def show_testcase(self, name):
+ tc_path = os.path.join(
+ constants.TESTCASE_PATH,
+ "%s.yml" % (name[9:] if name.startswith('dovetail.') else name))
+ if os.path.isfile(tc_path):
+ with open(tc_path, 'r') as stream:
+ try:
+ click.echo(stream.read())
+ except yaml.YAMLError as exc:
+ click.echo(exc)
else:
- testcase_yml = testcase + '.yml'
- for root, dirs, files in os.walk(abs_testcase_path):
- if testcase_yml in files:
- testcase_path = os.path.join(abs_testcase_path, testcase_yml)
- with open(testcase_path, 'r') as stream:
- try:
- click.echo(stream.read())
- except yaml.YAMLError as exc:
- click.echo(exc)
- else:
- click.echo("testcase %s does not exist or not supported"
- % testcase)
+ click.echo("testcase %s not exist or not supported" % name)
def run(self, args_str):
options = ''