Skip to content

INTERNAL ERROR when creating cobertura output for namespace package #19843

@Paebbels

Description

@Paebbels

Crash Report

Given the following directory structure:

myFramework/
  Extension/
    __init__.py
myPackage/
  __init__.py

and this pyproject.toml:

[tool.mypy]
packages = ["myFramework"]
namespace_packages = true
follow_untyped_imports = true
cobertura_xml_report = "report/typing"

then mypy crashes when using the namespace package's name in packages list despite having namespace_packages set to true.

Traceback

C:\Git\GitHub\pyTooling\Actions [dev ≡ +2 ~21 -0 !]> mypy --show-traceback
C:\Git\GitHub\pyTooling\Actions\myFramework: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.18.1
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Program Files\Python3.13\Scripts\mypy.exe\__main__.py", line 6, in <module>
    sys.exit(console_entry())
  File "mypy\build.py", line 2087, in wrap_context
PermissionError: [Errno 13] Permission denied: 'myFramework'
C:\Git\GitHub\pyTooling\Actions\myFramework: : note: use --pdb to drop into pdb
Generated Cobertura report: C:\Git\GitHub\pyTooling\Actions\report\typing\cobertura.xml

To Reproduce

See directory structure and pyproject.toml from above.
Used command was mypy --show-traceback.
All mypy parameters are loaded from pyproject.toml.

Your Environment

  • Mypy version used: 1.18.1
  • Mypy command-line flags: --show-traceback
  • Mypy configuration options from mypy.ini (and other config files): see :pyproject.toml` above
  • Python version used: 3.13
  • Operating system and version: Windows 11

Expected Behavior

  • mypy should not crash.
  • Don't raise a PermissionError: [Errno 13] Permission denied: 'myFramework' error, because there is NO PermissionError.
  • If the namespace package name should used differently, please give a hint and/or document this accordingly.

Additional Context:

  • Using packages = ["myPackage"] works.
  • Using packages = ["myFramework.Extension"] works as well.
  • When using packages = ["myFramework.Ext"] a correct error is emitted: Can't find package 'myFramework.Ext'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions