Skip to content

3.14 field annotation not covered #1908

Closed
@nickdrozd

Description

@nickdrozd

The following snippet gets counted as 100% coverage under 3.13 and earlier versions, but under 3.14 it is counted as having a missing line:

class X:
    x: int  # <-- not covered under 3.14
python3.14 -m coverage run asdf.py && python3.14 -m coverage combine --quiet && python3.14 -m coverage report --fail-under 100
Name      Stmts   Miss Branch BrPart  Cover
-------------------------------------------
asdf.py       2      1      0      0    50%
-------------------------------------------
TOTAL         2      1      0      0    50%
Coverage failure: total of 50 is less than fail-under=100

Adding from __future__ import annotations causes everything to be counted:

from __future__ import annotations

class X:
    x: int  # <-- covered

Could have something to do with https://docs.python.org/3.14/whatsnew/3.14.html#whatsnew314-pep649?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfixed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions