@@ -319,7 +319,7 @@ def visit_test(self, test: TestCase) -> None:
319
319
start = Position (line = test .lineno - 1 , character = 0 ),
320
320
end = Position (line = test .lineno - 1 , character = 0 ),
321
321
),
322
- tags = list (test .tags ) if test .tags else None ,
322
+ tags = list (set ( normalize ( str ( t ), ignore = "_" ) for t in test .tags ) ) if test .tags else None ,
323
323
)
324
324
except ValueError as e :
325
325
raise ValueError (f"Error while parsing suite { test .source } : { e } " ) from e
@@ -654,7 +654,7 @@ def print(items: List[TestItem]) -> Iterable[str]:
654
654
)
655
655
if show_tags and item .tags :
656
656
yield click .style (" Tags:" , bold = True )
657
- yield f" { ', ' . join (normalize (str (tag ), ignore = '_' ) for tag in item .tags )} { os .linesep } "
657
+ yield f" { ', ' . join (normalize (str (tag ), ignore = '_' ) for tag in sorted ( item .tags ) )} { os .linesep } "
658
658
659
659
if collector .tests :
660
660
app .echo_via_pager (print (collector .tests ))
@@ -785,7 +785,7 @@ def tags(
785
785
if app .config .output_format is None or app .config .output_format == OutputFormat .TEXT :
786
786
787
787
def print (tags : Dict [str , List [TestItem ]]) -> Iterable [str ]:
788
- for tag , items in tags .items ():
788
+ for tag , items in sorted ( tags .items () ):
789
789
yield click .style (f"{ tag } { os .linesep } " , bold = show_tests , fg = "green" if show_tests else None )
790
790
if show_tests :
791
791
for t in items :
0 commit comments