bobfang1992 / pytomlpp

A python wrapper for tomlplusplus
https://bobfang1992.github.io/pytomlpp/pytomlpp.html
MIT License
86 stars 11 forks source link

Python tests are failing with pytest>=7.0 #66

Closed mweinelt closed 2 years ago

mweinelt commented 2 years ago

After upgrading pytest past the 7.0 release we are seeing the following errors while running pytest:

==================================== ERRORS ====================================
________ ERROR at setup of test_loads_valid_toml_files[string-escapes] _________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7ffff68d70d0>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/runner.py:340: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/runner.py:261: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/nix/store/iwbyv0fk6sx0ihshpf0pw1ligp1qmdwg-python3.9-pluggy-1.0.0/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
/nix/store/iwbyv0fk6sx0ihshpf0pw1ligp1qmdwg-python3.9-pluggy-1.0.0/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/skipping.py:236: in pytest_runtest_setup
    skipped = evaluate_skip_marks(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <Function test_loads_valid_toml_files[string-escapes]>

    def evaluate_skip_marks(item: Item) -> Optional[Skip]:
        """Evaluate skip and skipif marks on item, returning Skip if triggered."""
        for mark in item.iter_markers(name="skipif"):
            if "condition" not in mark.kwargs:
                conditions = mark.args
            else:
                conditions = (mark.kwargs["condition"],)

            # Unconditional.
            if not conditions:
                reason = mark.kwargs.get("reason", "")
                return Skip(reason)

            # If any of the conditions are true.
            for condition in conditions:
                result, reason = evaluate_condition(item, mark, condition)
                if result:
                    return Skip(reason)

        for mark in item.iter_markers(name="skip"):
            try:
                return Skip(*mark.args, **mark.kwargs)
            except TypeError as e:
>               raise TypeError(str(e) + " - maybe you meant pytest.mark.skipif?") from None
E               TypeError: __init__() got an unexpected keyword argument 'reson' - maybe you meant pytest.mark.skipif?

/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/skipping.py:190: TypeError
____ ERROR at setup of test_round_trip_for_valid_toml_files[string-escapes] ____

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7ffff6503d30>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/runner.py:340: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/runner.py:261: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/nix/store/iwbyv0fk6sx0ihshpf0pw1ligp1qmdwg-python3.9-pluggy-1.0.0/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
/nix/store/iwbyv0fk6sx0ihshpf0pw1ligp1qmdwg-python3.9-pluggy-1.0.0/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/skipping.py:236: in pytest_runtest_setup
    skipped = evaluate_skip_marks(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <Function test_round_trip_for_valid_toml_files[string-escapes]>

    def evaluate_skip_marks(item: Item) -> Optional[Skip]:
        """Evaluate skip and skipif marks on item, returning Skip if triggered."""
        for mark in item.iter_markers(name="skipif"):
            if "condition" not in mark.kwargs:
                conditions = mark.args
            else:
                conditions = (mark.kwargs["condition"],)

            # Unconditional.
            if not conditions:
                reason = mark.kwargs.get("reason", "")
                return Skip(reason)

            # If any of the conditions are true.
            for condition in conditions:
                result, reason = evaluate_condition(item, mark, condition)
                if result:
                    return Skip(reason)

        for mark in item.iter_markers(name="skip"):
            try:
                return Skip(*mark.args, **mark.kwargs)
            except TypeError as e:
>               raise TypeError(str(e) + " - maybe you meant pytest.mark.skipif?") from None
E               TypeError: __init__() got an unexpected keyword argument 'reson' - maybe you meant pytest.mark.skipif?

/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/skipping.py:190: TypeError
_________ ERROR at setup of test_decode_encode_binary[string-escapes] __________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7ffff68ad5e0>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/runner.py:340: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/runner.py:261: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/nix/store/iwbyv0fk6sx0ihshpf0pw1ligp1qmdwg-python3.9-pluggy-1.0.0/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
/nix/store/iwbyv0fk6sx0ihshpf0pw1ligp1qmdwg-python3.9-pluggy-1.0.0/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/skipping.py:236: in pytest_runtest_setup
    skipped = evaluate_skip_marks(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <Function test_decode_encode_binary[string-escapes]>

    def evaluate_skip_marks(item: Item) -> Optional[Skip]:
        """Evaluate skip and skipif marks on item, returning Skip if triggered."""
        for mark in item.iter_markers(name="skipif"):
            if "condition" not in mark.kwargs:
                conditions = mark.args
            else:
                conditions = (mark.kwargs["condition"],)

            # Unconditional.
            if not conditions:
                reason = mark.kwargs.get("reason", "")
                return Skip(reason)

            # If any of the conditions are true.
            for condition in conditions:
                result, reason = evaluate_condition(item, mark, condition)
                if result:
                    return Skip(reason)

        for mark in item.iter_markers(name="skip"):
            try:
                return Skip(*mark.args, **mark.kwargs)
            except TypeError as e:
>               raise TypeError(str(e) + " - maybe you meant pytest.mark.skipif?") from None
E               TypeError: __init__() got an unexpected keyword argument 'reson' - maybe you meant pytest.mark.skipif?

/nix/store/6c9iqs6x50545pd3sg6qjbv01h8lwzaw-python3.9-pytest-7.0.1/lib/python3.9/site-packages/_pytest/skipping.py:190: TypeError
=========================== short test summary info ============================
ERROR python-tests/test_api.py::test_loads_valid_toml_files[string-escapes]
ERROR python-tests/test_api.py::test_round_trip_for_valid_toml_files[string-escapes]
ERROR python-tests/test_api.py::test_decode_encode_binary[string-escapes] - T...
=================== 254 passed, 4 skipped, 3 errors in 0.40s ===================
bobfang1992 commented 2 years ago

will take a look.