@@ -1911,7 +1911,7 @@ def write_fixture(fixture_def: FixtureDef[object]) -> None:
1911
1911
return
1912
1912
prettypath = _pretty_fixture_path (invocation_dir , fixture_def .func )
1913
1913
tw .write (f"{ argname } " , green = True )
1914
- ret_annotation = get_return_annotation (fixture_def )
1914
+ ret_annotation = get_return_annotation (fixture_def . func )
1915
1915
if ret_annotation :
1916
1916
tw .write (f" -> { ret_annotation } " , cyan = True )
1917
1917
tw .write (f" -- { prettypath } " , yellow = True )
@@ -1998,7 +1998,7 @@ def _showfixtures_main(config: Config, session: Session) -> None:
1998
1998
if verbose <= 0 and argname .startswith ("_" ):
1999
1999
continue
2000
2000
tw .write (f"{ argname } " , green = True )
2001
- ret_annotation = get_return_annotation (fixturedef )
2001
+ ret_annotation = get_return_annotation (fixturedef . func )
2002
2002
if ret_annotation :
2003
2003
tw .write (f" -> { ret_annotation } " , cyan = True )
2004
2004
if fixturedef .scope != "function" :
@@ -2015,12 +2015,12 @@ def _showfixtures_main(config: Config, session: Session) -> None:
2015
2015
tw .line ()
2016
2016
2017
2017
2018
- def get_return_annotation (fixturedef : FixtureDef [ object ] ) -> str :
2018
+ def get_return_annotation (fixture_func : Callable ) -> str :
2019
2019
try :
2020
- sig = signature (fixturedef . func )
2020
+ sig = signature (fixture_func )
2021
2021
annotation = sig .return_annotation
2022
2022
if annotation is not sig .empty and annotation != inspect ._empty :
2023
- return inspect .formatannotation (annotation )
2023
+ return inspect .formatannotation (annotation ). replace ( "'" , "" )
2024
2024
except (ValueError , TypeError ):
2025
2025
pass
2026
2026
return ""
0 commit comments