Skip to content

Commit 3740acc

Browse files
authored
TEST: add full test suite for annotations from archive 7.0 (#376)
1 parent 2976552 commit 3740acc

File tree

2 files changed

+353
-37
lines changed

2 files changed

+353
-37
lines changed

q2cli/builtin/tools.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,8 @@ def annotation_create(input_path, annotation_type,
14941494
name='annotation-remove',
14951495
short_help='Remove an Annotation from a QIIME 2 Result.',
14961496
help='Remove an existing Annotation (by name) from'
1497-
' an Artifact or Visualization.'
1497+
' an Artifact or Visualization.',
1498+
cls=ToolCommand
14981499
)
14991500
@click.option(
15001501
'--input-path',
@@ -1540,7 +1541,8 @@ def annotation_remove(input_path, name, output_path):
15401541
name='annotation-fetch',
15411542
short_help='Fetch an Annotation from a QIIME 2 Result.',
15421543
help='Fetch an existing Annotation (by name) from'
1543-
' an Artifact or Visualization.'
1544+
' an Artifact or Visualization.',
1545+
cls=ToolCommand
15441546
)
15451547
@click.option(
15461548
'--input-path',
@@ -1589,7 +1591,8 @@ def annotation_fetch(input_path, name, verbose):
15891591
name='annotation-list',
15901592
short_help='List Annotations on a QIIME 2 Result.',
15911593
help='List all Annotations that are attached to'
1592-
' an Artifact or Visualization.'
1594+
' an Artifact or Visualization.',
1595+
cls=ToolCommand
15931596
)
15941597
@click.option(
15951598
'--input-path',
@@ -1608,11 +1611,17 @@ def annotation_list(input_path):
16081611
result = qiime2.sdk.Result.load(input_path)
16091612

16101613
try:
1611-
annotations = result.iter_annotations()
1614+
annotations_iter = result.iter_annotations()
16121615
except Exception as e:
16131616
click.echo(CONFIG.cfg_style('error', str(e)), err=True)
16141617
raise click.Abort()
16151618

1619+
annotations = list(annotations_iter)
1620+
# we may as well raise an error here to make it clear
1621+
# that there are no annotations on the given result
1622+
if not annotations:
1623+
raise click.ClickException("No Annotations found.")
1624+
16161625
for annotation in annotations:
16171626
click.echo(CONFIG.cfg_style('type', "ID")+": ", nl=False)
16181627
click.echo(annotation.id)

0 commit comments

Comments
 (0)