Skip to content

Coverage: ModuleNotFoundError: No module named 'html.parser'; 'html' is not a package #1196

@supercairos

Description

@supercairos

🐞 bug report

Affected Rule

The issue is caused by the rule:
rules_python

Description

When activating coverage report in rules_python in a bazel workspace app that use Django, there is a clash in-between coverage.py and django that cause the html library to be re-imported

🔥 Exception or Error

==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
../../../../../../../../../../../../execroot/__main__/external/python3_9_aarch64-apple-darwin/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:680: in _load_unlocked
    ???
../pip_pytest/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
account/tests/conftest.py:2: in <module>
    from cbporm.cbp.models import User
cbporm/__init__.py:21: in <module>
    django.setup()
../pip_django/site-packages/django/__init__.py:16: in setup
    from django.urls import set_script_prefix
../pip_django/site-packages/django/urls/__init__.py:1: in <module>
    from .base import (
../pip_django/site-packages/django/urls/base.py:8: in <module>
    from .exceptions import NoReverseMatch, Resolver404
../pip_django/site-packages/django/urls/exceptions.py:1: in <module>
    from django.http import Http404
../pip_django/site-packages/django/http/__init__.py:5: in <module>
    from django.http.response import (
../pip_django/site-packages/django/http/response.py:16: in <module>
    from django.core.serializers.json import DjangoJSONEncoder
../pip_django/site-packages/django/core/serializers/__init__.py:23: in <module>
    from django.core.serializers.base import SerializerDoesNotExist
../pip_django/site-packages/django/core/serializers/base.py:7: in <module>
    from django.db import models
../pip_django/site-packages/django/db/models/__init__.py:3: in <module>
    from django.db.models.aggregates import *  # NOQA
../pip_django/site-packages/django/db/models/aggregates.py:5: in <module>
    from django.db.models.expressions import Case, Func, Star, When
../pip_django/site-packages/django/db/models/expressions.py:10: in <module>
    from django.db.models import fields
../pip_django/site-packages/django/db/models/fields/__init__.py:11: in <module>
    from django import forms
../pip_django/site-packages/django/forms/__init__.py:6: in <module>
    from django.forms.boundfield import *  # NOQA
../pip_django/site-packages/django/forms/boundfield.py:4: in <module>
    from django.forms.utils import flatatt, pretty_name
../pip_django/site-packages/django/forms/utils.py:7: in <module>
    from django.utils.html import escape, format_html, format_html_join, html_safe
../pip_django/site-packages/django/utils/html.py:6: in <module>
    from html.parser import HTMLParser
E   ModuleNotFoundError: No module named 'html.parser'; 'html' is not a package

🌍 Your Environment

Operating System:

  
macOS (M1)
  

Output of bazel version:

  
Bazelisk version: development
Build label: 6.1.2
Build target: bazel-out/darwin_arm64-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Apr 18 15:31:54 2023 (1681831914)
Build timestamp: 1681831914
Build timestamp as int: 1681831914
  

Rules_python version:

  
0.21.0
  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy