coveragepy icon indicating copy to clipboard operation
coveragepy copied to clipboard

Missing branches detail missing from JSON format

Open jaltmayerpizzorno opened this issue 2 years ago • 0 comments

Describe the bug Missing branches detail missing from JSON format

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

  1. What version of Python are you using?
$ python3 --version
Python 3.9.13
  1. What version of coverage.py shows the problem? The output of coverage debug sys is helpful.
$ python3 -m coverage debug sys
-- sys -------------------------------------------------------
               coverage_version: 6.4.2
                coverage_module: /opt/homebrew/lib/python3.9/site-packages/coverage/__init__.py
                         tracer: -none-
                        CTracer: available
           plugins.file_tracers: -none-
            plugins.configurers: -none-
      plugins.context_switchers: -none-
              configs_attempted: .coveragerc
                                 setup.cfg
                                 tox.ini
                                 pyproject.toml
                   configs_read: -none-
                    config_file: None
                config_contents: -none-
                      data_file: -none-
                         python: 3.9.13 (main, May 24 2022, 21:13:51) [Clang 13.1.6 (clang-1316.0.21.2)]
                       platform: macOS-12.5-arm64-arm-64bit
                 implementation: CPython
                     executable: /opt/homebrew/opt/[email protected]/bin/python3.9
                   def_encoding: utf-8
                    fs_encoding: utf-8
                            pid: 54555
                            cwd: /Users/juan/project/slipcover
                           path: /Users/juan/project/slipcover
                                 /opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python39.zip
                                 /opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9
                                 /opt/homebrew/Cellar/[email protected]/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload
                                 /opt/homebrew/lib/python3.9/site-packages
                                 /Users/juan/project/slipcover2
                                 /Users/juan/tmp/flask/src
                    environment: HOME = /Users/juan
                   command_line: /opt/homebrew/lib/python3.9/site-packages/coverage/__main__.py debug sys
                sqlite3_version: 2.6.0
         sqlite3_sqlite_version: 3.39.2
             sqlite3_temp_store: 0
        sqlite3_compile_options: ATOMIC_INTRINSICS=1, COMPILER=clang-13.1.6, DEFAULT_AUTOVACUUM,
                                 DEFAULT_CACHE_SIZE=-2000, DEFAULT_FILE_FORMAT=4,
                                 DEFAULT_JOURNAL_SIZE_LIMIT=-1, DEFAULT_MMAP_SIZE=0, DEFAULT_PAGE_SIZE=4096,
                                 DEFAULT_PCACHE_INITSZ=20, DEFAULT_RECURSIVE_TRIGGERS,
                                 DEFAULT_SECTOR_SIZE=4096, DEFAULT_SYNCHRONOUS=2,
                                 DEFAULT_WAL_AUTOCHECKPOINT=1000, DEFAULT_WAL_SYNCHRONOUS=2,
                                 DEFAULT_WORKER_THREADS=0, ENABLE_COLUMN_METADATA, ENABLE_FTS3,
                                 ENABLE_FTS3_PARENTHESIS, ENABLE_FTS4, ENABLE_FTS5, ENABLE_GEOPOLY,
                                 ENABLE_MATH_FUNCTIONS, ENABLE_PREUPDATE_HOOK, ENABLE_RTREE, ENABLE_SESSION,
                                 MALLOC_SOFT_LIMIT=1024, MAX_ATTACHED=10, MAX_COLUMN=2000,
                                 MAX_COMPOUND_SELECT=500, MAX_DEFAULT_PAGE_SIZE=8192, MAX_EXPR_DEPTH=1000,
                                 MAX_FUNCTION_ARG=127, MAX_LENGTH=1000000000, MAX_LIKE_PATTERN_LENGTH=50000,
                                 MAX_MMAP_SIZE=0x7fff0000, MAX_PAGE_COUNT=1073741823, MAX_PAGE_SIZE=65536,
                                 MAX_SQL_LENGTH=1000000000, MAX_TRIGGER_DEPTH=1000,
                                 MAX_VARIABLE_NUMBER=250000, MAX_VDBE_OP=250000000, MAX_WORKER_THREADS=8,
                                 MUTEX_PTHREADS, SYSTEM_MALLOC, TEMP_STORE=1, THREADSAFE=1
  1. What versions of what packages do you have installed? The output of pip freeze is helpful.
$ python3 -m pip freeze
attrs==21.4.0
click==8.1.3
coverage==6.4.2
cycler==0.11.0
-e git+ssh://[email protected]/pallets/flask.git@dba2be9311d2abfd1b973c6bb578f416ee771fda#egg=Flask
fonttools==4.34.4
importlib-metadata==4.12.0
iniconfig==1.1.1
itsdangerous==2.1.2
Jinja2==3.1.2
kiwisolver==1.4.4
MarkupSafe==2.1.1
matplotlib==3.5.2
numpy==1.23.1
packaging==21.3
Pillow==9.2.0
pluggy==1.0.0
py==1.11.0
py-cpuinfo==8.0.0
pyparsing==3.0.9
pyperf==2.4.0
pytest==7.1.2
pytest-repeat==0.9.1
python-dateutil==2.8.2
six==1.16.0
-e git+ssh://[email protected]/jaltmayerpizzorno/slipcover.git@1164e0d5449eae9e1b1ed4eda663475144fb1cb8#egg=slipcover
tabulate==0.8.10
tomli==2.0.1
typer==0.6.1
Werkzeug==2.2.1
zipp==3.8.1
  1. What code shows the problem? Give us a specific commit of a specific repo that we can check out. If you've already worked around the problem, please provide a commit before that fix.
x = 0
if x >= 0:
    x += 1
x += 2
  1. What commands did you run?
$ python3 -m coverage run --branch b.py; \
   python3 -m coverage report -m; \
   python3 -m coverage json; \
   python3 -m json.tool coverage.json
Name    Stmts   Miss Branch BrPart  Cover   Missing
---------------------------------------------------
b.py        4      0      2      1    83%   2->4
---------------------------------------------------
TOTAL       4      0      2      1    83%
Wrote JSON report to coverage.json
{
    "meta": {
        "version": "6.4.2",
        "timestamp": "2022-07-28T13:40:37.638100",
        "branch_coverage": true,
        "show_contexts": false
    },
    "files": {
        "b.py": {
            "executed_lines": [
                1,
                2,
                3,
                4
            ],
            "summary": {
                "covered_lines": 4,
                "num_statements": 4,
                "percent_covered": 83.33333333333333,
                "percent_covered_display": "83",
                "missing_lines": 0,
                "excluded_lines": 0,
                "num_branches": 2,
                "num_partial_branches": 1,
                "covered_branches": 1,
                "missing_branches": 1
            },
            "missing_lines": [],
            "excluded_lines": []
        }
    },
    "totals": {
        "covered_lines": 4,
        "num_statements": 4,
        "percent_covered": 83.33333333333333,
        "percent_covered_display": "83",
        "missing_lines": 0,
        "excluded_lines": 0,
        "num_branches": 2,
        "num_partial_branches": 1,
        "covered_branches": 1,
        "missing_branches": 1
    }
}

Expected behavior I'd expect the missing 2->4 branch to be shown somewhere in the JSON.

jaltmayerpizzorno avatar Jul 28 '22 17:07 jaltmayerpizzorno