@@ -1915,7 +1915,7 @@ def write_fixture(fixture_def: FixtureDef[object]) -> None:
1915
1915
return
1916
1916
prettypath = _pretty_fixture_path (invocation_dir , fixture_def .func )
1917
1917
tw .write (f"{ argname } " , green = True )
1918
- ret_annotation = get_return_annotation (fixture_def )
1918
+ ret_annotation = get_return_annotation (fixture_def . func )
1919
1919
if ret_annotation :
1920
1920
tw .write (f" -> { ret_annotation } " , cyan = True )
1921
1921
tw .write (f" -- { prettypath } " , yellow = True )
@@ -2002,7 +2002,7 @@ def _showfixtures_main(config: Config, session: Session) -> None:
2002
2002
if verbose <= 0 and argname .startswith ("_" ):
2003
2003
continue
2004
2004
tw .write (f"{ argname } " , green = True )
2005
- ret_annotation = get_return_annotation (fixturedef )
2005
+ ret_annotation = get_return_annotation (fixturedef . func )
2006
2006
if ret_annotation :
2007
2007
tw .write (f" -> { ret_annotation } " , cyan = True )
2008
2008
if fixturedef .scope != "function" :
@@ -2019,12 +2019,12 @@ def _showfixtures_main(config: Config, session: Session) -> None:
2019
2019
tw .line ()
2020
2020
2021
2021
2022
- def get_return_annotation (fixturedef : FixtureDef [ object ] ) -> str :
2022
+ def get_return_annotation (fixture_func : Callable ) -> str :
2023
2023
try :
2024
- sig = signature (fixturedef . func )
2024
+ sig = signature (fixture_func )
2025
2025
annotation = sig .return_annotation
2026
2026
if annotation is not sig .empty and annotation != inspect ._empty :
2027
- return inspect .formatannotation (annotation )
2027
+ return inspect .formatannotation (annotation ). replace ( "'" , "" )
2028
2028
except (ValueError , TypeError ):
2029
2029
pass
2030
2030
return ""
0 commit comments