- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.9k
Open
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errors
Description
What's the problem this feature will solve?
Knowing the annotated return types of fixtures in --fixtures could help users to understand what a fixture is/does, especially for fixtures that are missing a docstring.
Describe the solution you'd like
Something like
import pytest
@pytest.fixture
def answer() -> int:
    """Answer to the Ultimate Question of Life, the Universe, and Everything."""
    return 42currently displays:
------------------------- fixtures defined from test_x -------------------------
answer -- test_x.py:4
    Answer to the Ultimate Question of Life, the Universe, and Everything.
but could display:
------------------------- fixtures defined from test_x -------------------------
answer -> int -- test_x.py:4
    Answer to the Ultimate Question of Life, the Universe, and Everything.
or
------------------------- fixtures defined from test_x -------------------------
answer -- test_x.py:4
    Answer to the Ultimate Question of Life, the Universe, and Everything.
    Return type: int
or any other color of bike shed.
Alternative Solutions
Looking at the source code at the indicated location. Works, but is an extra step.
Additional context
I'm a bit confused between typing.get_type_hints(), inspect.get_annotations() (pre-3.14) and annotationlib (3.14+), and which one would be best to use for this purpose.
webknjaz and nicoddemuswebknjazwebknjaz
Metadata
Metadata
Assignees
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errors