Skip to content

chore(deps): bump coverage from 7.6.12 to 7.8.0 #17872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Mar 31, 2025

Bumps coverage from 7.6.12 to 7.8.0.

Changelog

Sourced from coverage's changelog.

Version 7.8.0 — 2025-03-30

  • Added a new source_dirs setting for symmetry with the existing source_pkgs setting. It's preferable to the existing source setting, because you'll get a clear error when directories don't exist. Fixes issue 1942. Thanks, Jeremy Fleischman <pull 1943_>.

  • Fix: the PYTHONSAFEPATH environment variable new in Python 3.11 is properly supported, closing issue 1696. Thanks, Philipp A. <pull 1700_>. This works properly except for a detail when using the coverage command on Windows. There you can use python -m coverage instead if you need exact emulation.

.. _issue 1696: nedbat/coveragepy#1696 .. _pull 1700: nedbat/coveragepy#1700 .. _issue 1942: nedbat/coveragepy#1942 .. _pull 1943: nedbat/coveragepy#1943

.. _changes_7-7-1:

Version 7.7.1 — 2025-03-21

  • A few small tweaks to the sys.monitoring support for Python 3.14. Please test!

.. _changes_7-7-0:

Version 7.7.0 — 2025-03-16

  • The Coverage object has a new method, :meth:.Coverage.branch_stats for getting simple branch information for a module. Closes issue 1888_.

  • The :class:Coverage constructor<.Coverage> now has a plugins parameter for passing in plugin objects directly, thanks to Alex Gaynor <pull 1919_>_.

  • Many constant tests in if statements are now recognized as being optimized away. For example, previously if 13: would have been considered a branch with one path not taken. Now it is understood as always true and no coverage is missing.

  • The experimental sys.monitoring support now works for branch coverage if you are using Python 3.14.0 alpha 6 or newer. This should reduce the overhead coverage.py imposes on your test suite. Set the environment variable COVERAGE_CORE=sysmon to try it out.

... (truncated)

Commits
  • 6d5ced9 docs: sample HTML for 7.8.0
  • 49c194f docs: prep for 7.8.0
  • 38782cb docs: finish up source_dirs. bump to 7.8.0
  • 7aea2f3 feat: add new source_dirs option (#1943)
  • f464155 test: some simple bytecode tests
  • cf1dec0 refactor: these pypy modules are available in all our versions
  • a876052 test: a general helper for iterating over our own source files
  • 82cff3e perf: sets are better than lists
  • a66bd61 refactor: move bytecode code into bytecode.py
  • d64ce5f chore: bump the action-dependencies group with 3 updates (#1940)
  • Additional commits viewable in compare view

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

@dependabot dependabot bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Mar 31, 2025
@dependabot dependabot bot requested a review from a team as a code owner March 31, 2025 09:30
@pypi-combine-prs pypi-combine-prs bot mentioned this pull request Mar 31, 2025
@ewdurbin ewdurbin added the blocked Issues we can't or shouldn't get to yet label Mar 31, 2025
@ewdurbin
Copy link
Member

blocking until perf is assessed.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Bumps [coverage](https://github.com/nedbat/coveragepy) from 7.6.12 to 7.8.0.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](nedbat/coveragepy@7.6.12...7.8.0)

---
updated-dependencies:
- dependency-name: coverage
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/pip/coverage-7.8.0 branch from a98b3d1 to c892185 Compare April 1, 2025 09:37

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@miketheman
Copy link
Member

Casual testing this today still shows a slowdown (amongst lots of warning messages) from 24 seconds to 37 seconds.

@miketheman
Copy link
Member

Interestingly enough, the new behavior will auto-default back to the ctrace approach if either configs are active:

branch = true
dynamic_context = "test_function"

Disabling both gives me a test run of ~19s, which is an improvement, but at the cost of missing branches and not having coverage contexts.

In March, the author posted about new branch coverage speeds, but requires a dev version of 3.14 and dev of coverage, so not exactly an option for now.
https://nedbatchelder.com/blog/202503/faster_branch_coverage_measurement.html

What's further interesting is that there's a "fight" between the env var setting of COVERAGE_CORE=sysmon and the config file - and the config file is winning.

@nedbat
Copy link

nedbat commented May 1, 2025

I'd like to understand the configurations that too slow. We need to include: the version of coverage.py, the Python version, and the coverage configuration. The best way to get the information is to add --debug=sys,config to your coverage run command.

@miketheman
Copy link
Member

Thanks for checking in, @nedbat !

Here's the "current, fast" method on cfc7015 with the --debug command added.

$ make tests
...
+ python -m coverage run --debug=sys,config -m pytest --strict-markers --postgresql-host db
-- config ----------------------------------------------------
                         branch: True
                   command_line: None
                    concurrency: -none-
                    config_file: /opt/warehouse/src/pyproject.toml
         config_files_attempted: /opt/warehouse/src/.coveragerc
                                 /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/tox.ini
                                 /opt/warehouse/src/pyproject.toml
              config_files_read: /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/pyproject.toml
                        context: None
                    cover_pylib: False
                      data_file: .coverage
                          debug: sys
                                 config
                     debug_file: None
               disable_warnings: -none-
                dynamic_context: test_function
                   exclude_also: -none-
                   exclude_list: pragma: no cover
                                 class \w+\(Interface\):
                                 if (typing\.)?TYPE_CHECKING:
                      extra_css: None
                     fail_under: 0.0
                         format: None
                       html_dir: htmlcov
              html_skip_covered: None
                html_skip_empty: None
                     html_title: Coverage report
                  ignore_errors: False
     include_namespace_packages: False
                    json_output: coverage.json
              json_pretty_print: False
             json_show_contexts: False
            lcov_line_checksums: False
                    lcov_output: coverage.lcov
                       parallel: True
            partial_always_list: while (True|1|False|0):
                                 if (True|1|False|0):
                   partial_list: #\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(branch|BRANCH)
                          paths: {}
                 plugin_options: {}
                        plugins: -none-
                      precision: 0
                 relative_files: False
                report_contexts: None
                 report_include: None
                    report_omit: None
                    run_include: -none-
                       run_omit: warehouse/migrations/*
                                 warehouse/__main__.py
                                 warehouse/wsgi.py
                                 warehouse/celery.py
                  show_contexts: False
                   show_missing: False
                        sigterm: False
                   skip_covered: False
                     skip_empty: False
                           sort: None
                         source: warehouse
                    source_pkgs: -none-
                          timid: False
                     xml_output: coverage.xml
              xml_package_depth: 99
-- sys -------------------------------------------------------
               coverage_version: 7.6.12
                coverage_module: /opt/warehouse/lib/python3.13/site-packages/coverage/__init__.py
                           core: SysMonitor
                        CTracer: available
           plugins.file_tracers: -none-
            plugins.configurers: -none-
      plugins.context_switchers: -none-
              configs_attempted: /opt/warehouse/src/.coveragerc
                                 /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/tox.ini
                                 /opt/warehouse/src/pyproject.toml
                   configs_read: /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/pyproject.toml
                    config_file: /opt/warehouse/src/pyproject.toml
                config_contents: b'[tool.coverage.run]\nbranch = true\ndynamic_context = "test_function"\nsource = ["warehouse"]\nomit = [\n  # We don\'t want to get coverage information for our migrations.\n  "warehouse/migrations/*",\n\n  # We don\'t want to actually cover our __main__.py file because it is hard\n  # to cover and it really just acts as a tiny shim to a function.\n  "warehouse/__main__.py",\n\n  # Again, tiny shim code that we don\'t actually need to test and trying to\n  # do so would just get in the way.\n  "warehouse/wsgi.py",\n\n  # And again, tiny shim code.\n  "warehouse/celery.py",\n]\n# We run multiple processes in parallel, so we need to make sure that we don\'t\n# write to the same file at the same time.\nparallel = true\n\n[tool.coverage.report]\nexclude_lines = [\n  "pragma: no cover",\n  "class \\\\w+\\\\(Interface\\\\):",\n  "if (typing\\\\.)?TYPE_CHECKING:",\n]\n\n[tool.curlylint]\ninclude = \'\\.(html|jinja|txt)$\'\n# For jinja\'s i18n extension:\ntemplate_tags = [[\'trans\', \'pluralize\', \'endtrans\']]\n\n[tool.isort]\nprofile = \'black\'\nlines_between_types = 1\ncombine_as_imports = true\nknown_first_party = [\'warehouse\', \'tests\']\n\n[tool.mypy]\npython_version = "3.12"\nwarn_unused_configs = true\nwarn_unused_ignores = true\nplugins = ["mypy_zope:plugin"]\nexclude = ["warehouse/locale/.*", "warehouse/migrations/versions.*"]\ncache_dir = "dev/.mypy_cache"\n\n[[tool.mypy.overrides]]\n# These modules do not yet have types available.\nmodule = [\n    "bpython.*",  # https://github.com/bpython/bpython/issues/892\n    "b2sdk.*",  # https://github.com/Backblaze/b2-sdk-python/issues/148\n    "celery.app.backends.*",\n    "celery.backends.redis.*",\n    "github_reserved_names.*",  # https://github.com/Julian/github-reserved-names/pull/10\n    "google.cloud.*",\n    "forcediphttpsadapter.*",\n    "IPython.*",  # has types, but only installed in dev\n    "packaging_legacy.*",  # https://github.com/di/packaging_legacy/pull/5\n    "paginate.*",\n    "paginate_sqlalchemy.*",\n    "premailer.*",\n    "pymacaroons.*", # https://github.com/ecordell/pymacaroons/issues/41\n    "pyramid.*", # https://github.com/Pylons/pyramid/issues/2638\n    "pyramid_jinja2.*",\n    "pyramid_mailer.*",\n    "pyramid_retry.*",\n    "pyramid_rpc.*",\n    "pyqrcode.*",\n    "requests_aws4auth.*",  # https://github.com/tedder/requests-aws4auth/issues/53\n    "rfc3986.*",  # https://github.com/python-hyper/rfc3986/issues/122\n    "transaction.*",\n    "ua_parser.*",  # https://github.com/ua-parser/uap-python/issues/110\n    "venusian.*",\n    "whitenoise.*",  # https://github.com/evansd/whitenoise/pull/410\n    "zope.sqlalchemy.*",\n]\nignore_missing_imports = true\n\n[tool.pytest.ini_options]\naddopts = [\n  "--disable-socket",\n  "--allow-hosts=localhost,::1,stripe,redis",\n  "--durations=20",\n  "--numprocesses=auto",\n  # Disable ddtrace for tests\n  "-p no:ddtrace",\n  "-p no:ddtrace.pytest_bdd",\n  "-p no:ddtrace.pytest_benchmark",\n]\ncache_dir = "dev/.pytest_cache"\ntestpaths = ["tests/"]\nmarkers = [\n    \'unit: Quick running unit tests which test small units of functionality.\',\n    \'functional: Slower running tests which test the entire system is functioning.\',\n]\nfilterwarnings = [\n    \'ignore::warehouse.utils.exceptions.DevelopmentModeWarning\',\n    \'error:SELECT statement has a cartesian product:sqlalchemy.exc.SAWarning\',\n]\n\n[tool.pip-tools.compile]\n# TODO: This can be removed once it becomes the default.\n# See: https://github.com/jazzband/pip-tools/issues/989\nallow-unsafe = true\n'
                      data_file: /opt/warehouse/src/.coverage.2345bf4569ac.11.XRsLVojx
                         python: 3.13.2 (main, Apr  8 2025, 08:56:23) [GCC 12.2.0]
                       platform: Linux-6.13.7-orbstack-00283-g9d1400e7e9c6-aarch64-with-glibc2.36
                 implementation: CPython
                    gil_enabled: True
                     executable: /opt/warehouse/bin/python
                   def_encoding: utf-8
                    fs_encoding: utf-8
                            pid: 11
                            cwd: /opt/warehouse/src
                           path: /opt/warehouse/src
                                 /opt/warehouse/src
                                 /usr/local/lib/python313.zip
                                 /usr/local/lib/python3.13
                                 /usr/local/lib/python3.13/lib-dynload
                                 /opt/warehouse/lib/python3.13/site-packages
                    environment: COVERAGE = yes
                                 COVERAGE_CORE = sysmon
                                 COVERAGE_PROCESS_START = /opt/warehouse/src/pyproject.toml
                                 COVERAGE_RUN = true
                                 HOME = /root
                                 PYTHONPATH = /opt/warehouse/src/
                                 PYTHONUNBUFFERED = 1
                                 PYTHON_SHA256 = d984bcc57cd67caab26f7def42e523b1c015bbc5dc07836cf4f0b63fa159eb56
                                 PYTHON_VERSION = 3.13.2
                   command_line: /opt/warehouse/lib/python3.13/site-packages/coverage/__main__.py run --debug=sys,config -m pytest --strict-markers --postgresql-host db
                 coverage_paths: /opt/warehouse/lib/python3.13/site-packages/coverage
                   stdlib_paths: /usr/local/lib/python3.13/re
                                 /usr/local/lib/python3.13/sysconfig
                                 /usr/local/lib/python3.13
              third_party_paths: /opt/warehouse/lib/python
                                 /root/.local/lib/python3.13/site-packages
                                 /root/.local/bin
                                 /opt/warehouse/bin
                                 /opt/warehouse/lib/python3.13/site-packages
                   source_match: /opt/warehouse/src/warehouse
              source_pkgs_match: -none-
                  include_match: -none-
                     omit_match: warehouse/migrations/*
                                 /opt/warehouse/src/warehouse/migrations/*
                                 warehouse/__main__.py
                                 /opt/warehouse/src/warehouse/__main__.py
                                 warehouse/wsgi.py
                                 /opt/warehouse/src/warehouse/wsgi.py
                                 warehouse/celery.py
                                 /opt/warehouse/src/warehouse/celery.py
                    cover_match: /opt/warehouse/lib/python3.13/site-packages/coverage
                    pylib_match: -none-
                    third_match: /opt/warehouse/bin
                                 /opt/warehouse/lib/python
                                 /opt/warehouse/lib/python3.13/site-packages
                                 /root/.local/bin
                                 /root/.local/lib/python3.13/site-packages
          source_in_third_match: -none-
         sqlite3_sqlite_version: 3.40.1
             sqlite3_temp_store: 0
        sqlite3_compile_options: ATOMIC_INTRINSICS=1, COMPILER=gcc-12.2.0, 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_DBSTAT_VTAB,
                                 ENABLE_FTS3, ENABLE_FTS3_PARENTHESIS, ENABLE_FTS3_TOKENIZER, ENABLE_FTS4,
                                 ENABLE_FTS5, ENABLE_LOAD_EXTENSION, ENABLE_MATH_FUNCTIONS,
                                 ENABLE_PREUPDATE_HOOK, ENABLE_RTREE, ENABLE_SESSION, ENABLE_STMTVTAB,
                                 ENABLE_UNLOCK_NOTIFY, ENABLE_UPDATE_DELETE_LIMIT, HAVE_ISNAN,
                                 LIKE_DOESNT_MATCH_BLOBS, MALLOC_SOFT_LIMIT=1024, MAX_ATTACHED=10,
                                 MAX_COLUMN=2000, MAX_COMPOUND_SELECT=500, MAX_DEFAULT_PAGE_SIZE=32768,
                                 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_SCHEMA_RETRY=25,
                                 MAX_SQL_LENGTH=1000000000, MAX_TRIGGER_DEPTH=1000,
                                 MAX_VARIABLE_NUMBER=250000, MAX_VDBE_OP=250000000, MAX_WORKER_THREADS=8,
                                 MUTEX_PTHREADS, OMIT_LOOKASIDE, SECURE_DELETE, SOUNDEX, SYSTEM_MALLOC,
                                 TEMP_STORE=1, THREADSAFE=1, USE_URI
-- end -------------------------------------------------------
...
Results (21.06s):
    4748 passed
...

And the same, with 7.8.0 applied:

$ make tests
...
+ python -m coverage run --debug=sys,config -m pytest --strict-markers --postgresql-host db
/opt/warehouse/lib/python3.13/site-packages/coverage/core.py:80: CoverageWarning: sys.monitoring can't measure branches in this version, using default core (no-sysmon)
  warn(f"sys.monitoring {reason_no_sysmon}, using default core", slug="no-sysmon")
-- config ----------------------------------------------------
                         branch: True
                   command_line: None
                    concurrency: -none-
                    config_file: /opt/warehouse/src/pyproject.toml
         config_files_attempted: /opt/warehouse/src/.coveragerc
                                 /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/tox.ini
                                 /opt/warehouse/src/pyproject.toml
              config_files_read: /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/pyproject.toml
                        context: None
                    cover_pylib: False
                      data_file: .coverage
                          debug: sys
                                 config
                     debug_file: None
               disable_warnings: -none-
                dynamic_context: test_function
                   exclude_also: -none-
                   exclude_list: pragma: no cover
                                 class \w+\(Interface\):
                                 if (typing\.)?TYPE_CHECKING:
                      extra_css: None
                     fail_under: 0.0
                         format: None
                       html_dir: htmlcov
              html_skip_covered: None
                html_skip_empty: None
                     html_title: Coverage report
                  ignore_errors: False
     include_namespace_packages: False
                    json_output: coverage.json
              json_pretty_print: False
             json_show_contexts: False
            lcov_line_checksums: False
                    lcov_output: coverage.lcov
                       parallel: True
            partial_always_list: while (True|1|False|0):
                                 if (True|1|False|0):
                   partial_list: #\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(branch|BRANCH)
                          paths: {}
                 plugin_options: {}
                        plugins: -none-
                      precision: 0
                 relative_files: False
                report_contexts: None
                 report_include: None
                    report_omit: None
                    run_include: -none-
                       run_omit: warehouse/migrations/*
                                 warehouse/__main__.py
                                 warehouse/wsgi.py
                                 warehouse/celery.py
                  show_contexts: False
                   show_missing: False
                        sigterm: False
                   skip_covered: False
                     skip_empty: False
                           sort: None
                         source: warehouse
                    source_dirs: -none-
                    source_pkgs: -none-
                          timid: False
                     xml_output: coverage.xml
              xml_package_depth: 99
-- sys -------------------------------------------------------
               coverage_version: 7.8.0
                coverage_module: /opt/warehouse/lib/python3.13/site-packages/coverage/__init__.py
                           core: CTracer
                        CTracer: available
           plugins.file_tracers: -none-
            plugins.configurers: -none-
      plugins.context_switchers: -none-
              configs_attempted: /opt/warehouse/src/.coveragerc
                                 /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/tox.ini
                                 /opt/warehouse/src/pyproject.toml
                   configs_read: /opt/warehouse/src/setup.cfg
                                 /opt/warehouse/src/pyproject.toml
                    config_file: /opt/warehouse/src/pyproject.toml
                config_contents: b'[tool.coverage.run]\nbranch = true\ndynamic_context = "test_function"\nsource = ["warehouse"]\nomit = [\n  # We don\'t want to get coverage information for our migrations.\n  "warehouse/migrations/*",\n\n  # We don\'t want to actually cover our __main__.py file because it is hard\n  # to cover and it really just acts as a tiny shim to a function.\n  "warehouse/__main__.py",\n\n  # Again, tiny shim code that we don\'t actually need to test and trying to\n  # do so would just get in the way.\n  "warehouse/wsgi.py",\n\n  # And again, tiny shim code.\n  "warehouse/celery.py",\n]\n# We run multiple processes in parallel, so we need to make sure that we don\'t\n# write to the same file at the same time.\nparallel = true\n\n[tool.coverage.report]\nexclude_lines = [\n  "pragma: no cover",\n  "class \\\\w+\\\\(Interface\\\\):",\n  "if (typing\\\\.)?TYPE_CHECKING:",\n]\n\n[tool.curlylint]\ninclude = \'\\.(html|jinja|txt)$\'\n# For jinja\'s i18n extension:\ntemplate_tags = [[\'trans\', \'pluralize\', \'endtrans\']]\n\n[tool.isort]\nprofile = \'black\'\nlines_between_types = 1\ncombine_as_imports = true\nknown_first_party = [\'warehouse\', \'tests\']\n\n[tool.mypy]\npython_version = "3.12"\nwarn_unused_configs = true\nwarn_unused_ignores = true\nplugins = ["mypy_zope:plugin"]\nexclude = ["warehouse/locale/.*", "warehouse/migrations/versions.*"]\ncache_dir = "dev/.mypy_cache"\n\n[[tool.mypy.overrides]]\n# These modules do not yet have types available.\nmodule = [\n    "bpython.*",  # https://github.com/bpython/bpython/issues/892\n    "b2sdk.*",  # https://github.com/Backblaze/b2-sdk-python/issues/148\n    "celery.app.backends.*",\n    "celery.backends.redis.*",\n    "github_reserved_names.*",  # https://github.com/Julian/github-reserved-names/pull/10\n    "google.cloud.*",\n    "forcediphttpsadapter.*",\n    "IPython.*",  # has types, but only installed in dev\n    "packaging_legacy.*",  # https://github.com/di/packaging_legacy/pull/5\n    "paginate.*",\n    "paginate_sqlalchemy.*",\n    "premailer.*",\n    "pymacaroons.*", # https://github.com/ecordell/pymacaroons/issues/41\n    "pyramid.*", # https://github.com/Pylons/pyramid/issues/2638\n    "pyramid_jinja2.*",\n    "pyramid_mailer.*",\n    "pyramid_retry.*",\n    "pyramid_rpc.*",\n    "pyqrcode.*",\n    "requests_aws4auth.*",  # https://github.com/tedder/requests-aws4auth/issues/53\n    "rfc3986.*",  # https://github.com/python-hyper/rfc3986/issues/122\n    "transaction.*",\n    "ua_parser.*",  # https://github.com/ua-parser/uap-python/issues/110\n    "venusian.*",\n    "whitenoise.*",  # https://github.com/evansd/whitenoise/pull/410\n    "zope.sqlalchemy.*",\n]\nignore_missing_imports = true\n\n[tool.pytest.ini_options]\naddopts = [\n  "--disable-socket",\n  "--allow-hosts=localhost,::1,stripe,redis",\n  "--durations=20",\n  "--numprocesses=auto",\n  # Disable ddtrace for tests\n  "-p no:ddtrace",\n  "-p no:ddtrace.pytest_bdd",\n  "-p no:ddtrace.pytest_benchmark",\n]\ncache_dir = "dev/.pytest_cache"\ntestpaths = ["tests/"]\nmarkers = [\n    \'unit: Quick running unit tests which test small units of functionality.\',\n    \'functional: Slower running tests which test the entire system is functioning.\',\n]\nfilterwarnings = [\n    \'ignore::warehouse.utils.exceptions.DevelopmentModeWarning\',\n    \'error:SELECT statement has a cartesian product:sqlalchemy.exc.SAWarning\',\n]\n\n[tool.pip-tools.compile]\n# TODO: This can be removed once it becomes the default.\n# See: https://github.com/jazzband/pip-tools/issues/989\nallow-unsafe = true\n'
                      data_file: /opt/warehouse/src/.coverage.28b04deb06f9.21.XddypEqx
                         python: 3.13.2 (main, Apr  8 2025, 08:56:23) [GCC 12.2.0]
                       platform: Linux-6.13.7-orbstack-00283-g9d1400e7e9c6-aarch64-with-glibc2.36
                 implementation: CPython
                    gil_enabled: True
                     executable: /opt/warehouse/bin/python
                   def_encoding: utf-8
                    fs_encoding: utf-8
                            pid: 21
                            cwd: /opt/warehouse/src
                           path: /opt/warehouse/src
                                 /opt/warehouse/src
                                 /usr/local/lib/python313.zip
                                 /usr/local/lib/python3.13
                                 /usr/local/lib/python3.13/lib-dynload
                                 /opt/warehouse/lib/python3.13/site-packages
                    environment: COVERAGE = yes
                                 COVERAGE_CORE = sysmon
                                 COVERAGE_PROCESS_START = /opt/warehouse/src/pyproject.toml
                                 COVERAGE_RUN = true
                                 HOME = /root
                                 PYTHONPATH = /opt/warehouse/src/
                                 PYTHONUNBUFFERED = 1
                                 PYTHON_SHA256 = d984bcc57cd67caab26f7def42e523b1c015bbc5dc07836cf4f0b63fa159eb56
                                 PYTHON_VERSION = 3.13.2
                   command_line: /opt/warehouse/lib/python3.13/site-packages/coverage/__main__.py run --debug=sys,config -m pytest --strict-markers --postgresql-host db
                 coverage_paths: /opt/warehouse/lib/python3.13/site-packages/coverage
                   stdlib_paths: /usr/local/lib/python3.13
                                 /usr/local/lib/python3.13/re
                                 /usr/local/lib/python3.13/sysconfig
              third_party_paths: /root/.local/lib/python3.13/site-packages
                                 /opt/warehouse/lib/python3.13/site-packages
                                 /root/.local/bin
                                 /opt/warehouse/bin
                                 /opt/warehouse/lib/python
                   source_match: /opt/warehouse/src/warehouse
              source_pkgs_match: -none-
                  include_match: -none-
                     omit_match: warehouse/migrations/*
                                 /opt/warehouse/src/warehouse/migrations/*
                                 warehouse/__main__.py
                                 /opt/warehouse/src/warehouse/__main__.py
                                 warehouse/wsgi.py
                                 /opt/warehouse/src/warehouse/wsgi.py
                                 warehouse/celery.py
                                 /opt/warehouse/src/warehouse/celery.py
                    cover_match: /opt/warehouse/lib/python3.13/site-packages/coverage
                    pylib_match: -none-
                    third_match: /opt/warehouse/bin
                                 /opt/warehouse/lib/python
                                 /opt/warehouse/lib/python3.13/site-packages
                                 /root/.local/bin
                                 /root/.local/lib/python3.13/site-packages
          source_in_third_match: -none-
         sqlite3_sqlite_version: 3.40.1
             sqlite3_temp_store: 0
        sqlite3_compile_options: ATOMIC_INTRINSICS=1, COMPILER=gcc-12.2.0, 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_DBSTAT_VTAB,
                                 ENABLE_FTS3, ENABLE_FTS3_PARENTHESIS, ENABLE_FTS3_TOKENIZER, ENABLE_FTS4,
                                 ENABLE_FTS5, ENABLE_LOAD_EXTENSION, ENABLE_MATH_FUNCTIONS,
                                 ENABLE_PREUPDATE_HOOK, ENABLE_RTREE, ENABLE_SESSION, ENABLE_STMTVTAB,
                                 ENABLE_UNLOCK_NOTIFY, ENABLE_UPDATE_DELETE_LIMIT, HAVE_ISNAN,
                                 LIKE_DOESNT_MATCH_BLOBS, MALLOC_SOFT_LIMIT=1024, MAX_ATTACHED=10,
                                 MAX_COLUMN=2000, MAX_COMPOUND_SELECT=500, MAX_DEFAULT_PAGE_SIZE=32768,
                                 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_SCHEMA_RETRY=25,
                                 MAX_SQL_LENGTH=1000000000, MAX_TRIGGER_DEPTH=1000,
                                 MAX_VARIABLE_NUMBER=250000, MAX_VDBE_OP=250000000, MAX_WORKER_THREADS=8,
                                 MUTEX_PTHREADS, OMIT_LOOKASIDE, SECURE_DELETE, SOUNDEX, SYSTEM_MALLOC,
                                 TEMP_STORE=1, THREADSAFE=1, USE_URI
-- end -------------------------------------------------------
...
Results (32.98s):
    4712 passed

@nedbat
Copy link

nedbat commented May 1, 2025

Do I have it right that coverage 7.6.12 is faster and 7.8.0 is slower? The thing I notice is that your 7.6.12 has core: SysMonitor in the sys output, but 7.8.0 has core: CTracer. I would expect there's a coverage warning in your test output:

sys.monitoring can't measure branches in this version, using default core

which is why the core becomes CTracer.

It surprises me that this would be slower though? The core reverts to CTracer because every evidence I had was that branches with sys.monitoring were too slow.

If you want to neuter that decision, you can try commenting out these lines: https://github.com/nedbat/coveragepy/blob/master/coverage/core.py#L79-L81:

        if core_name == "sysmon" and reason_no_sysmon:
            warn(f"sys.monitoring {reason_no_sysmon}, using default core", slug="no-sysmon")
            core_name = None

I'll be interested to hear what you find.

@miketheman
Copy link
Member

miketheman commented May 1, 2025

coverage 7.6.12 is faster and 7.8.0 is slower

Yes, that's correct.

7.6.12 has core: SysMonitor in the sys output, but 7.8.0 has core: CTracer. I would expect there's a coverage warning in your test output

We set COVERAGE_CORE=sysmon to activate the behavior, and no such warning is emitted in 7.6.12, but these do raise during 7.8.0.

Commenting those three lines raises another error, specifically:

+ python -m coverage run -m pytest --strict-markers --postgresql-host db
ERROR: while parsing the following warning configuration:

  ignore::warehouse.utils.exceptions.DevelopmentModeWarning

This error occurred:

Traceback (most recent call last):
  File "/opt/warehouse/lib/python3.13/site-packages/_pytest/config/__init__.py", line 1918, in parse_warning_filter
    category: type[Warning] = _resolve_warning_category(category_)
                              ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/opt/warehouse/lib/python3.13/site-packages/_pytest/config/__init__.py", line 1956, in _resolve_warning_category
    m = __import__(module, None, None, [klass])
  File "/opt/warehouse/src/warehouse/__init__.py", line 0, in <module>

    # Licensed under the Apache License, Version 2.0 (the "License");
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/sysmon.py", line 364, in sysmon_py_start
    assert env.PYBEHAVIOR.branch_right_left
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

I thought it was something weird with the filterwarnings syntax, so I commented that out and re-ran, but the test fails at the same spot - assert env.PYBEHAVIOR.branch_right_left,
so I tried to "force" that to be truthy (setting to version 3, 13 or higher), but that failed as well with:

AttributeError: 'types.SimpleNamespace' object has no attribute 'BRANCH_RIGHT'
+ python -m coverage run -m pytest --strict-markers --postgresql-host db
Error in sitecustomize; set PYTHONVERBOSE for traceback:
AttributeError: 'types.SimpleNamespace' object has no attribute 'BRANCH_RIGHT'
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/__main__.py", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/cmdline.py", line 970, in main
    status = CoverageScript().command_line(argv)
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/cmdline.py", line 681, in command_line
    return self.do_run(options, args)
           ~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/cmdline.py", line 855, in do_run
    self.coverage.start()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/control.py", line 680, in start
    self._collector.start()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/collector.py", line 331, in start
    self._start_tracer()
    ~~~~~~~~~~~~~~~~~~^^
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/collector.py", line 285, in _start_tracer
    fn = tracer.start()
  File "/opt/warehouse/lib/python3.13/site-packages/coverage/sysmon.py", line 250, in start
    sys_monitoring.use_tool_id(self.myid, "coverage.py")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: tool 1 is already in use

I'm not certain where to go next.

@nedbat
Copy link

nedbat commented May 1, 2025

We set COVERAGE_CORE=sysmon to activate the behavior, and no such warning is emitted in 7.6.12, but these do raise during 7.8.0.

Sorry, yes, the warning is new in 7.7.0.

assert env.PYBEHAVIOR.branch_right_left

and

AttributeError: 'types.SimpleNamespace' object has no attribute 'BRANCH_RIGHT'

My bad, I forgot that the branch support code is truly requiring features that are new in 3.14:

At this point I think your best option is to stick with 7.6.12.

@miketheman
Copy link
Member

@dependabot ignore this dependency

@dependabot dependabot bot closed this May 2, 2025
Copy link
Contributor Author

dependabot bot commented on behalf of github May 2, 2025

OK, I won't notify you about coverage again, unless you re-open this PR.

@dependabot dependabot bot deleted the dependabot/pip/coverage-7.8.0 branch May 2, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Issues we can't or shouldn't get to yet dependencies Pull requests that update a dependency file python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants