Skip to content

Conversation

@bearomorphism
Copy link
Collaborator

Description

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Documentation Changes

  • Run uv run poe doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external)

Expected Behavior

Steps to Test This Pull Request

Additional Context

@codecov
Copy link

codecov bot commented Feb 9, 2026

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
1272 4 1268 5
View the top 3 failed test(s) by shortest run time
tests\providers\test_base_provider.py::providers::test_base_provider::test_json_provider_uses_encoding_with_encoding_fixture
Stack Traces | 0.017s run time
config = <commitizen.config.base_config.BaseConfig object at 0x000002012C099310>
chdir = WindowsPath('C:.../pytest-0/popen-gw1/test_json_provider_uses_encodi0')
data_dir = WindowsPath('D:.../commitizen/tests/data')

    def test_json_provider_uses_encoding_with_encoding_fixture(
        config: BaseConfig,
        chdir: Path,
        data_dir: Path,
    ):
        """JsonProvider should correctly read a JSON file with non-ASCII content."""
        source = data_dir / "encoding_test_composer.json"
        target = chdir / "composer.json"
        target.write_text(source.read_text(encoding="utf-8"), encoding="utf-8")
    
        config.settings["encoding"] = "utf-8"
        config.settings["version_provider"] = "composer"
    
        provider = get_provider(config)
        assert isinstance(provider, ComposerProvider)
>       assert provider.get_version() == "0.1.0"
               ^^^^^^^^^^^^^^^^^^^^^^

D:\a\commitizen\commitizen\tests\providers\test_base_provider.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\commitizen\commitizen\commitizen\providers\base_provider.py:61: in get_version
    document = json.loads(self.file.read_text())
                          ^^^^^^^^^^^^^^^^^^^^^
C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\pathlib\__init__.py:788: in read_text
    return f.read()
           ^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <encodings.cp1252.IncrementalDecoder object at 0x000002012B5F2120>
input = b'{\r\n  "name": "encoding-test-composer",\r\n  "description": "\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82 \xd0\xbe\xd0\xbf\xd0\...d0\xb8 \xd0\xba\xd0\xbe\xd0\xb4\xd0\xb8\xd1\x80\xd0\xbe\xd0\xb2\xd0\xba\xd0\xb8",\r\n  "version": "0.1.0"\r\n}\r\n\r\n'
final = True

    def decode(self, input, final=False):
>       return codecs.charmap_decode(input,self.errors,decoding_table)[0]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 63: character maps to <undefined>

C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\encodings\cp1252.py:23: UnicodeDecodeError
tests\providers\test_base_provider.py::providers::test_base_provider::test_json_provider_handles_various_unicode_characters
Stack Traces | 0.019s run time
config = <commitizen.config.base_config.BaseConfig object at 0x000002012C101670>
chdir = WindowsPath('C:.../pytest-0/popen-gw1/test_json_provider_handles_var0')

    def test_json_provider_handles_various_unicode_characters(
        config: BaseConfig,
        chdir: Path,
    ):
        """JsonProvider should handle a wide range of Unicode characters."""
        config.settings["encoding"] = "utf-8"
        config.settings["version_provider"] = "composer"
    
        filename = ComposerProvider.filename
        file = chdir / filename
        file.write_text(
            (
                "{\n"
                '  "name": "多言語-имя-árbol",\n'
                '  "description": "Emoji #x1F600 – 漢字 – العربية",\n'
                '  "version": "0.1.0"\n'
                "}\n"
            ),
            encoding="utf-8",
        )
    
        provider = get_provider(config)
        assert isinstance(provider, ComposerProvider)
>       assert provider.get_version() == "0.1.0"
               ^^^^^^^^^^^^^^^^^^^^^^

D:\a\commitizen\commitizen\tests\providers\test_base_provider.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\commitizen\commitizen\commitizen\providers\base_provider.py:61: in get_version
    document = json.loads(self.file.read_text())
                          ^^^^^^^^^^^^^^^^^^^^^
C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\pathlib\__init__.py:788: in read_text
    return f.read()
           ^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <encodings.cp1252.IncrementalDecoder object at 0x000002012B5C8D70>
input = b'{\r\n  "name": "\xe5\xa4\x9a\xe8\xa8\x80\xe8\xaa\x9e-\xd0\xb8\xd0\xbc\xd1\x8f-\xc3\xa1rbol",\r\n  "description": "Em...2\xe5\xad\x97 \xe2\x80\x93 \xd8\xa7\xd9\x84\xd8\xb9\xd8\xb1\xd8\xa8\xd9\x8a\xd8\xa9",\r\n  "version": "0.1.0"\r\n}\r\n'
final = True

    def decode(self, input, final=False):
>       return codecs.charmap_decode(input,self.errors,decoding_table)[0]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 29: character maps to <undefined>

C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\encodings\cp1252.py:23: UnicodeDecodeError
tests\providers\test_base_provider.py::providers::test_base_provider::test_toml_provider_uses_encoding_with_encoding_fixture
Stack Traces | 0.021s run time
config = <commitizen.config.base_config.BaseConfig object at 0x000002012BF16D50>
chdir = WindowsPath('C:.../pytest-0/popen-gw1/test_toml_provider_uses_encodi0')
data_dir = WindowsPath('D:.../commitizen/tests/data')

    def test_toml_provider_uses_encoding_with_encoding_fixture(
        config: BaseConfig,
        chdir: Path,
        data_dir: Path,
    ):
        """TomlProvider should correctly read a TOML file with non-ASCII content."""
        source = data_dir / "encoding_test_pyproject.toml"
        target = chdir / "pyproject.toml"
        target.write_text(source.read_text(encoding="utf-8"), encoding="utf-8")
    
        config.settings["encoding"] = "utf-8"
        config.settings["version_provider"] = "uv"
    
        provider = get_provider(config)
        assert isinstance(provider, UvProvider)
>       assert provider.get_version() == "0.4.1"
               ^^^^^^^^^^^^^^^^^^^^^^

D:\a\commitizen\commitizen\tests\providers\test_base_provider.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\commitizen\commitizen\commitizen\providers\base_provider.py:82: in get_version
    document = tomlkit.parse(self.file.read_text())
                             ^^^^^^^^^^^^^^^^^^^^^
C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\pathlib\__init__.py:788: in read_text
    return f.read()
           ^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <encodings.cp1252.IncrementalDecoder object at 0x000002012B405400>
input = b'[project]\r\nname = "pythonproject-test"\r\nversion = "0.4.1"\r\ndescription = "Add your description here"\r\nreadme...6\xd0\xb8\xd0\xb8" },\r\n    { value = "misc", name = "misc: \xd0\x94\xd1\x80\xd1\x83\xd0\xb3\xd0\xbe\xd0\xb5" },\r\n]'
final = True

    def decode(self, input, final=False):
>       return codecs.charmap_decode(input,self.errors,decoding_table)[0]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 749: character maps to <undefined>

C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\encodings\cp1252.py:23: UnicodeDecodeError
tests\providers\test_base_provider.py::providers::test_base_provider::test_toml_provider_handles_various_unicode_characters
Stack Traces | 0.024s run time
config = <commitizen.config.base_config.BaseConfig object at 0x000002012C1032F0>
chdir = WindowsPath('C:.../pytest-0/popen-gw1/test_toml_provider_handles_var0')

    def test_toml_provider_handles_various_unicode_characters(
        config: BaseConfig,
        chdir: Path,
    ):
        """TomlProvider should handle a wide range of Unicode characters."""
        config.settings["encoding"] = "utf-8"
        config.settings["version_provider"] = "pep621"
    
        filename = Pep621Provider.filename
        file = chdir / filename
        file.write_text(
            (
                "[project]\n"
                'name = "多言語-имя-árbol"\n'
                'description = "Emoji #x1F600 – 漢字 – العربية"\n'
                'version = "0.1.0"\n'
            ),
            encoding="utf-8",
        )
    
        provider = get_provider(config)
        assert isinstance(provider, Pep621Provider)
>       assert provider.get_version() == "0.1.0"
               ^^^^^^^^^^^^^^^^^^^^^^

D:\a\commitizen\commitizen\tests\providers\test_base_provider.py:116: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\commitizen\commitizen\commitizen\providers\base_provider.py:82: in get_version
    document = tomlkit.parse(self.file.read_text())
                             ^^^^^^^^^^^^^^^^^^^^^
C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\pathlib\__init__.py:788: in read_text
    return f.read()
           ^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <encodings.cp1252.IncrementalDecoder object at 0x000002012B5C8050>
input = b'[project]\r\nname = "\xe5\xa4\x9a\xe8\xa8\x80\xe8\xaa\x9e-\xd0\xb8\xd0\xbc\xd1\x8f-\xc3\xa1rbol"\r\ndescription = "E...e6\xbc\xa2\xe5\xad\x97 \xe2\x80\x93 \xd8\xa7\xd9\x84\xd8\xb9\xd8\xb1\xd8\xa8\xd9\x8a\xd8\xa9"\r\nversion = "0.1.0"\r\n'
final = True

    def decode(self, input, final=False):
>       return codecs.charmap_decode(input,self.errors,decoding_table)[0]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 34: character maps to <undefined>

C:\hostedtoolcache\windows\Python\3.14.2\x64\Lib\encodings\cp1252.py:23: UnicodeDecodeError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant