coverage run does not ignore .venv dir, so it tracks all dependencies and python internal files · Issue #876 · nedbat/coveragepy (original) (raw)

Describe the bug
A clear and concise description of the bug.

To Reproduce
How can we reproduce the problem? Please be specific.

  1. What version of Python are you using? Python 3.7.4
  2. What version of coverage.py are you using? The output of coverage debug sys is helpful.
    -- sys -------------------------------------------------------
                version: 4.5.4
                coverage: /Users/h14384/Documents/work/cm-ch-engine/venv/lib/python3.7/site-packages/coverage/__init__.py
            cover_paths: /Users/h14384/Documents/work/cm-ch-engine/venv/lib/python3.7/site-packages/coverage
            pylib_paths: /Users/h14384/.pyenv/versions/3.7.4/lib/python3.7
                tracer: CTracer
    plugins.file_tracers: -none-
    plugins.configurers: -none-
            config_files: .coveragerc
                        setup.cfg
                        tox.ini
            configs_read: -none-
                data_path: /Users/h14384/Documents/work/cm-ch-engine/.coverage
                python: 3.7.4 (default, Aug 15 2019, 12:39:43) [Clang 10.0.1 (clang-1001.0.46.4)]
                platform: Darwin-18.7.0-x86_64-i386-64bit
        implementation: CPython
            executable: /Users/h14384/Documents/work/cm-ch-engine/venv/bin/python
                    cwd: /Users/h14384/Documents/work/cm-ch-engine
                    path: 
                        /Users/h14384/.pyenv/versions/3.7.4/lib/python37.zip
                        /Users/h14384/.pyenv/versions/3.7.4/lib/python3.7
                        /Users/h14384/.pyenv/versions/3.7.4/lib/python3.7/lib-dynload
                        /Users/h14384/Documents/work/cm-ch-engine/venv/lib/python3.7/site-packages
            environment: PYENV_SHELL = zsh
            command_line: /Users/h14384/Documents/work/cm-ch-engine/venv/bin/coverage debug sys
            source_match: -none-
        source_pkgs_match: -none-
            include_match: -none-
            omit_match: -none-
            cover_match: /Users/h14384/Documents/work/cm-ch-engine/venv/lib/python3.7/site-packages/coverage
            pylib_match: /Users/h14384/.pyenv/versions/3.7.4/lib/python3.7

  1. What versions of what packages do you have installed? The output of pip freeze is helpful.
    astroid==2.2.5
    autopep8==1.4.3
    boto3==1.9.208
    botocore==1.12.208
    certifi==2018.11.29
    chardet==3.0.4
    coverage==4.5.4
    Django==2.1.3
    django-debug-toolbar==2.0
    django-silk==3.0.2
    djangorestframework==3.9.0
    docutils==0.14
    fsspec==0.4.4
    gprof2dot==2016.10.13
    idna==2.8
    isort==4.3.21
    Jinja2==2.10
    jmespath==0.9.4
    lazy-object-proxy==1.4.1
    MarkupSafe==1.1.0
    mccabe==0.6.1
    memory-profiler==0.55.0
    mysqlclient==1.4.4
    numpy==1.16.4
    pandas==0.25.0
    pbr==5.1.1
    pep8==1.7.1
    psutil==5.6.3
    psycopg2==2.8.3
    pyarrow==0.14.1
    pycodestyle==2.4.0
    Pygments==2.3.1
    pylint==2.3.1
    pylint-django==2.0.11
    pylint-plugin-utils==0.5
    pymongo==3.9.0
    PyMySQL==0.9.3
    python-dateutil==2.7.5
    pytz==2018.7
    requests==2.21.0
    rope==0.14.0
    s3fs==0.3.3
    s3transfer==0.2.1
    scipy==1.3.0
    selenium==3.141.0
    six==1.11.0
    sqlparse==0.2.4
    stevedore==1.30.0
    typed-ast==1.4.0
    urllib3==1.24.1
    virtualenv==16.1.0
    virtualenv-clone==0.4.0
    virtualenvwrapper==4.8.2
    wrapt==1.11.2
  1. What code are you running? Give us a specific commit of a specific repo that we can check out.

A Django app

  1. What commands did you run?

coverage run manage.py test

Expected behavior
Coverage for my project files only, not every file in the environment including the python standard library.

Additional context

    venv/lib/python3.7/site-packages/urllib3/util/request.py                                                                  45     36    20%
    venv/lib/python3.7/site-packages/urllib3/util/response.py                                                                 35     29    17%
    venv/lib/python3.7/site-packages/urllib3/util/retry.py                                                                   150    102    32%
    venv/lib/python3.7/site-packages/urllib3/util/ssl_.py                                                                    147    114    22%
    venv/lib/python3.7/site-packages/urllib3/util/timeout.py                                                                  59     29    51%
    venv/lib/python3.7/site-packages/urllib3/util/url.py                                                                     103     87    16%
    venv/lib/python3.7/site-packages/urllib3/util/wait.py                                                                     77     59    23%
    ------------------------------------------------------------------------------------------------------------------------------------------
    TOTAL                                                                                                                 221690 156052    30%