@@ -1915,7 +1915,7 @@ def write_fixture(fixture_def: FixtureDef[object]) -> None:
19151915 return
19161916 prettypath = _pretty_fixture_path (invocation_dir , fixture_def .func )
19171917 tw .write (f"{ argname } " , green = True )
1918- ret_annotation = get_return_annotation (fixture_def )
1918+ ret_annotation = get_return_annotation (fixture_def . func )
19191919 if ret_annotation :
19201920 tw .write (f" -> { ret_annotation } " , cyan = True )
19211921 tw .write (f" -- { prettypath } " , yellow = True )
@@ -2002,7 +2002,7 @@ def _showfixtures_main(config: Config, session: Session) -> None:
20022002 if verbose <= 0 and argname .startswith ("_" ):
20032003 continue
20042004 tw .write (f"{ argname } " , green = True )
2005- ret_annotation = get_return_annotation (fixturedef )
2005+ ret_annotation = get_return_annotation (fixturedef . func )
20062006 if ret_annotation :
20072007 tw .write (f" -> { ret_annotation } " , cyan = True )
20082008 if fixturedef .scope != "function" :
@@ -2019,12 +2019,12 @@ def _showfixtures_main(config: Config, session: Session) -> None:
20192019 tw .line ()
20202020
20212021
2022- def get_return_annotation (fixturedef : FixtureDef [ object ] ) -> str :
2022+ def get_return_annotation (fixture_func : Callable ) -> str :
20232023 try :
2024- sig = signature (fixturedef . func )
2024+ sig = signature (fixture_func )
20252025 annotation = sig .return_annotation
20262026 if annotation is not sig .empty and annotation != inspect ._empty :
2027- return inspect .formatannotation (annotation )
2027+ return inspect .formatannotation (annotation ). replace ( "'" , "" )
20282028 except (ValueError , TypeError ):
20292029 pass
20302030 return ""
0 commit comments