Skip to content

coverage combine cannot find local plugin files #1979

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

Open
Jacobfaib opened this issue May 29, 2025 · 0 comments
Open

coverage combine cannot find local plugin files #1979

Jacobfaib opened this issue May 29, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Jacobfaib
Copy link

Describe the bug
Consider a project:

pyproject.toml
my_local_plugin.py
src/
  foo.py
# pyproject.toml
[tool.coverage.run]
plugins = ["my_local_plugin"]
# my_local_plugin.py
def coverage_init(*args, **kwargs):
    pass

And then

# From project root directory (location of pyproject.toml)
$ coverage run foo.py
$ coverage combine
Traceback (most recent call last):
  File "/path/to/venv/bin/coverage", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/path/to/venv/lib/python3.13/site-packages/coverage/cmdline.py", line 970, in main
    status = CoverageScript().command_line(argv)
  File "/path/to/venv/lib/python3.13/site-packages/coverage/cmdline.py", line 681, in command_line
    return self.do_run(options, args)
           ~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.13/site-packages/coverage/cmdline.py", line 855, in do_run
    self.coverage.start()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/path/to/venv/lib/python3.13/site-packages/coverage/control.py", line 660, in start
    self._init()
    ~~~~~~~~~~^^
  File "/path/to/venv/lib/python3.13/site-packages/coverage/control.py", line 365, in _init
    self._plugins.load_from_config(self.config.plugins, self.config)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.13/site-packages/coverage/plugin_support.py", line 48, in load_from_config
    __import__(module)
    ~~~~~~~~~~^^^^^^^^
ModuleNotFoundError: No module named 'my_local_plugin'

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? 3.13
  2. What version of coverage.py shows the problem? The output of coverage debug sys is helpful.
$ coverage debug sys
-- sys -------------------------------------------------------
               coverage_version: 7.8.2
                coverage_module: /Users/jfaibussowit/soft/nv/legate.core.internal/venv/lib/python3.13/site-packages/coverage/__init__.py
                           core: -none-
                        CTracer: available from /Users/jfaibussowit/soft/nv/legate.core.internal/venv/lib/python3.13/site-packages/coverage/tracer.cpython-313-darwin.so
           plugins.file_tracers: -none-
            plugins.configurers: -none-
      plugins.context_switchers: -none-
              configs_attempted: /Users/jfaibussowit/soft/nv/.coveragerc
                                 /Users/jfaibussowit/soft/nv/setup.cfg
                                 /Users/jfaibussowit/soft/nv/tox.ini
                                 /Users/jfaibussowit/soft/nv/pyproject.toml
                   configs_read: -none-
                    config_file: None
                config_contents: -none-
                      data_file: -none-
                         python: 3.13.3 (main, Apr  8 2025, 13:54:08) [Clang 17.0.0 (clang-1700.0.13.3)]
                       platform: macOS-15.4.1-arm64-arm-64bit-Mach-O
                 implementation: CPython
                    gil_enabled: True
                     executable: /Users/jfaibussowit/soft/nv/legate.core.internal/venv/bin/python
                   def_encoding: utf-8
                    fs_encoding: utf-8
                            pid: 63286
                            cwd: /Users/jfaibussowit/soft/nv
                           path: /Users/jfaibussowit/soft/nv/legate.core.internal/venv/bin
                                 /opt/homebrew/Cellar/[email protected]/3.13.3_1/Frameworks/Python.framework/Versions/3.13/lib/python313.zip
                                 /opt/homebrew/Cellar/[email protected]/3.13.3_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13
                                 /opt/homebrew/Cellar/[email protected]/3.13.3_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/lib-dynload
                                 /Users/jfaibussowit/soft/nv/legate.core.internal/venv/lib/python3.13/site-packages
                    environment: HOME = /Users/jfaibussowit
                                 PYTHONBREAKPOINT = ipdb.set_trace
                   command_line: /Users/jfaibussowit/soft/nv/legate.core.internal/venv/bin/coverage debug sys
         sqlite3_sqlite_version: 3.49.2
             sqlite3_temp_store: 0
        sqlite3_compile_options: ATOMIC_INTRINSICS=1, COMPILER=clang-17.0.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, DIRECT_OVERFLOW_READ, ENABLE_API_ARMOR,
                                 ENABLE_COLUMN_METADATA, ENABLE_DBSTAT_VTAB, ENABLE_FTS3,
                                 ENABLE_FTS3_PARENTHESIS, ENABLE_FTS5, ENABLE_MATH_FUNCTIONS,
                                 ENABLE_MEMORY_MANAGEMENT, ENABLE_PREUPDATE_HOOK, ENABLE_RTREE,
                                 ENABLE_SESSION, ENABLE_STAT4, ENABLE_UNLOCK_NOTIFY, 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=1000,
                                 MAX_LENGTH=1000000000, MAX_LIKE_PATTERN_LENGTH=50000,
                                 MAX_MMAP_SIZE=0x7fff0000, MAX_PAGE_COUNT=0xfffffffe, 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, USE_URI

Expected behavior
coverage should be able to import the package, using the current working directory. Setting PYTHONPATH=$(pwd) then of course it works.

@Jacobfaib Jacobfaib added the bug Something isn't working label May 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant