Skip to content
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

Python 3.13 test failure: tests/config/loader/test_str_convert.py::test_str_convert_ok_py39[1,2-value1-Optional] - TypeError: issubclass() arg 1 must be a class #3290

Open
mgorny opened this issue Jun 7, 2024 · 0 comments

Comments

@mgorny
Copy link
Contributor

mgorny commented Jun 7, 2024

Issue

When running the test suite on Python 3.13.0b1, I'm getting the following test failure:

____________________________________________ test_str_convert_ok_py39[1,2-value1-Optional] ____________________________________________

raw = '1,2', value = ['1', '2'], of_type = typing.Optional[list[str]]

    @pytest.mark.parametrize(
        ("raw", "value", "of_type"),
        [
            ("", None, Optional[list[str]]),
            ("1,2", ["1", "2"], Optional[list[str]]),
        ],
    )
    def test_str_convert_ok_py39(raw: str, value: Any, of_type: type[Any]) -> None:
>       result = StrConvert().to(raw, of_type, None)

of_type    = typing.Optional[list[str]]
raw        = '1,2'
value      = ['1', '2']

tests/config/loader/test_str_convert.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../tox-4.15.1-python3_13/install/usr/lib/python3.13/site-packages/tox/config/loader/convert.py:32: in to
    return self._to_typing(raw, of_type, factory)
        factory    = None
        from_module = 'typing'
        of_type    = typing.Optional[list[str]]
        raw        = '1,2'
        self       = <tox.config.loader.str_convert.StrConvert object at 0x7fdd060385a0>
../tox-4.15.1-python3_13/install/usr/lib/python3.13/site-packages/tox/config/loader/convert.py:79: in _to_typing
    result = self.to(raw, new_type, factory)
        args       = (list[str], <class 'NoneType'>)
        factory    = None
        new_type   = list[str]
        none       = <class 'NoneType'>
        of_type    = typing.Optional[list[str]]
        origin     = typing.Union
        raw        = '1,2'
        result     = <object object at 0x7fdd090df730>
        self       = <tox.config.loader.str_convert.StrConvert object at 0x7fdd060385a0>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <tox.config.loader.str_convert.StrConvert object at 0x7fdd060385a0>, raw = '1,2', of_type = list[str], factory = None

    def to(self, raw: T, of_type: type[V], factory: Factory[V]) -> V:  # noqa: PLR0911
        """
        Convert given raw type to python type.
    
        :param raw: the raw type
        :param of_type: python type
        :param factory: factory method to build the object
        :return: the converted type
        """
        from_module = getattr(of_type, "__module__", None)
        if from_module in {"typing", "typing_extensions"}:
            return self._to_typing(raw, of_type, factory)
>       if issubclass(of_type, Path):
E       TypeError: issubclass() arg 1 must be a class

factory    = None
from_module = 'builtins'
of_type    = list[str]
raw        = '1,2'
self       = <tox.config.loader.str_convert.StrConvert object at 0x7fdd060385a0>

../tox-4.15.1-python3_13/install/usr/lib/python3.13/site-packages/tox/config/loader/convert.py:33: TypeError

Apparently, this is intentional change: python/cpython#101162

Environment

Provide at least:

  • OS: Gentoo Linux amd64

Output of running tox

n/a

Minimal example

n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant