@@ -1911,7 +1911,7 @@ def write_fixture(fixture_def: FixtureDef[object]) -> None:
19111911 return
19121912 prettypath = _pretty_fixture_path (invocation_dir , fixture_def .func )
19131913 tw .write (f"{ argname } " , green = True )
1914- ret_annotation = get_return_annotation (fixture_def )
1914+ ret_annotation = get_return_annotation (fixture_def . func )
19151915 if ret_annotation :
19161916 tw .write (f" -> { ret_annotation } " , cyan = True )
19171917 tw .write (f" -- { prettypath } " , yellow = True )
@@ -1998,7 +1998,7 @@ def _showfixtures_main(config: Config, session: Session) -> None:
19981998 if verbose <= 0 and argname .startswith ("_" ):
19991999 continue
20002000 tw .write (f"{ argname } " , green = True )
2001- ret_annotation = get_return_annotation (fixturedef )
2001+ ret_annotation = get_return_annotation (fixturedef . func )
20022002 if ret_annotation :
20032003 tw .write (f" -> { ret_annotation } " , cyan = True )
20042004 if fixturedef .scope != "function" :
@@ -2015,12 +2015,12 @@ def _showfixtures_main(config: Config, session: Session) -> None:
20152015 tw .line ()
20162016
20172017
2018- def get_return_annotation (fixturedef : FixtureDef [ object ] ) -> str :
2018+ def get_return_annotation (fixture_func : Callable ) -> str :
20192019 try :
2020- sig = signature (fixturedef . func )
2020+ sig = signature (fixture_func )
20212021 annotation = sig .return_annotation
20222022 if annotation is not sig .empty and annotation != inspect ._empty :
2023- return inspect .formatannotation (annotation )
2023+ return inspect .formatannotation (annotation ). replace ( "'" , "" )
20242024 except (ValueError , TypeError ):
20252025 pass
20262026 return ""
0 commit comments