@@ -319,7 +319,7 @@ def visit_test(self, test: TestCase) -> None:
319319 start = Position (line = test .lineno - 1 , character = 0 ),
320320 end = Position (line = test .lineno - 1 , character = 0 ),
321321 ),
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 ,
323323 )
324324 except ValueError as e :
325325 raise ValueError (f"Error while parsing suite { test .source } : { e } " ) from e
@@ -654,7 +654,7 @@ def print(items: List[TestItem]) -> Iterable[str]:
654654 )
655655 if show_tags and item .tags :
656656 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 } "
658658
659659 if collector .tests :
660660 app .echo_via_pager (print (collector .tests ))
@@ -785,7 +785,7 @@ def tags(
785785 if app .config .output_format is None or app .config .output_format == OutputFormat .TEXT :
786786
787787 def print (tags : Dict [str , List [TestItem ]]) -> Iterable [str ]:
788- for tag , items in tags .items ():
788+ for tag , items in sorted ( tags .items () ):
789789 yield click .style (f"{ tag } { os .linesep } " , bold = show_tests , fg = "green" if show_tests else None )
790790 if show_tests :
791791 for t in items :
0 commit comments