Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Coverage reporting nonsenical branch miss under Python 3.10 #1249

@tseaver

Description

@tseaver

Describe the bug
From this PR, with this failed build.

While adding support for Python 3.10 to https://github.com/googleapis/python-ndb, we see a nonsense result from the summary coverage report: each of the individual unit-x.y jobs reports 100% coverage (including branch coverage), but the summary reports some branches as missed. Part of the nonsense is that if those branches were missed, there would be huge gaps in statement coverage, which aren't being reported.

To Reproduce
How can we reproduce the problem? Please be specific. Don't just link to a failing CI job. Answer the questions below:

  1. What version of Python are you using?\

    Python 2.7.18, Python 3.6.15, Python 3.7.12, Python 3.8.12, Python 3.9.7, Python 3.10.0

  2. What version of coverage.py are you using? The output of coverage debug sys is helpful.

    $ .nox/cover/bin/coverage debug sys$ .nox/cover/bin/coverage debug sys
    -- sys -------------------------------------------------------
                   coverage_version: 6.0.2
                    coverage_module: .../src/python-ndb/.nox/cover/lib/python3.8/site-packages/coverage/__init__.py
                             tracer: -none-
                            CTracer: available
               plugins.file_tracers: -none-
                plugins.configurers: -none-
          plugins.context_switchers: -none-
                  configs_attempted: .coveragerc
                       configs_read: .../src/python-ndb/.coveragerc
                        config_file: .../src/python-ndb/.coveragerc
                    config_contents: b'[run]\nbranch = True\n\n[report]\nfail_under = 100\nshow_missing = True\nexclude_lines =\n    # Re-enable the standard pragma\n    pragma: NO COVER\n    pragma: NO PY${PY_VERSION} COVER\nomit =\n  */gapic/*.py\n  */proto/*.py\n'
                          data_file: -none-
                             python: 3.8.12 (default, Sep 10 2021, 18:10:10) [GCC 9.3.0]
                           platform: Linux-5.13.0-7614-generic-x86_64-with-glibc2.29
                     implementation: CPython
                         executable: .../src/python-ndb/.nox/cover/bin/python
                       def_encoding: utf-8
                        fs_encoding: utf-8
                                pid: 10362
                                cwd: .../src/python-ndb
                               path: .../src/python-ndb/.nox/cover/bin
                                     /opt/Python-3.8.12/lib/python38.zip
                                     /opt/Python-3.8.12/lib/python3.8
                                    /opt/Python-3.8.12/lib/python3.8/lib-dynload
                                    .../src/python-ndb/.nox/cover/lib/python3.8/site-packages
                       environment: HOME = /home/tseaver
                      command_line: .nox/cover/bin/coverage debug sys
                   sqlite3_version: 2.6.0
            sqlite3_sqlite_version: 3.31.1
                sqlite3_temp_store: 0
           sqlite3_compile_options: COMPILER=gcc-9.3.0; ENABLE_COLUMN_METADATA; ENABLE_DBSTAT_VTAB
                                    ENABLE_FTS3; ENABLE_FTS3_PARENTHESIS; ENABLE_FTS3_TOKENIZER
                                    ENABLE_FTS4; ENABLE_FTS5; ENABLE_JSON1
                                    ENABLE_LOAD_EXTENSION; ENABLE_PREUPDATE_HOOK; ENABLE_RTREE
                                    ENABLE_SESSION; ENABLE_STMTVTAB; ENABLE_UNLOCK_NOTIFY
                                    ENABLE_UPDATE_DELETE_LIMIT; HAVE_ISNAN; LIKE_DOESNT_MATCH_BLOBS
                                    MAX_SCHEMA_RETRY=25; MAX_VARIABLE_NUMBER=250000; OMIT_LOOKASIDE
                                    SECURE_DELETE; SOUNDEX; TEMP_STORE=1
                                    THREADSAFE=1; USE_URI
    
  3. What versions of what packages do you have installed? The output of pip freeze is helpful.

    $ .nox/cover/bin/pip freeze
    coverage==6.0.2
    $ .nox/unit-3-10/bin/pip freeze
    attrs==21.2.0
    cachetools==4.2.4
    certifi==2021.10.8
    charset-normalizer==2.0.7
    coverage==6.0.2
    google-api-core==1.31.3
    google-auth==1.35.0
    google-cloud-core==1.7.2
    google-cloud-datastore==1.15.3
    -e git+ssh://[email protected]/googleapis/python-ndb@5cc1001fa78eb9f2aca99c050d1d1518ae3e8f01#egg=google_cloud_ndb
    googleapis-common-protos==1.53.0
    grpcio==1.41.0
    idna==3.3
    iniconfig==1.1.1
    mock==4.0.3
    packaging==21.0
    pluggy==1.0.0
    protobuf==3.17.3
    py==1.10.0
    pyasn1==0.4.8
    pyasn1-modules==0.2.8
    pymemcache==3.5.0
    pyparsing==2.4.7
    pytest==6.2.5
    pytest-cov==3.0.0
    pytz==2021.3
    redis==3.5.3
    requests==2.26.0
    rsa==4.7.2
    six==1.16.0
    toml==0.10.2
    tomli==1.2.1
    urllib3==1.26.7
    
  4. What code are you running? Give us a specific commit of a specific repo that we can check out.

    googleapis/python-ndb@5cc1001

  5. What commands did you run?

    $ nox -s unit cover
    

Expected behavior

Given that each unit-x.y nox session, including the unit-3.10 one, reports 100% coverage, I
expect that the summary coverage will also show 100% coverage.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions