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

dummy tests fail tests: takes 1 positional argument but 2 were given #173

Closed
trofi opened this issue Jun 21, 2021 · 3 comments
Closed

dummy tests fail tests: takes 1 positional argument but 2 were given #173

trofi opened this issue Jun 21, 2021 · 3 comments

Comments

@trofi
Copy link

trofi commented Jun 21, 2021

Noticed when ran tests as part of distribution packaging:

$ python3.10 ./setup.py build
...
$ pytest
pytest
================================================================================================ test session starts ================================================================================================
platform linux -- Python 3.10.0b3, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /home/slyfox/dev/git/distorm
plugins: pkgcore-0.12.1
collected 369 items

python/test_distorm3.py EEE.................................................................................................................................................................................. [ 49%]
............................................................................................................................................................................................                  [100%]

====================================================================================================== ERRORS =======================================================================================================
_________________________________________________________________________________________ ERROR at setup of Test.test_dummy _________________________________________________________________________________________

cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x7f5c18f1b910>, 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]":
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.10/site-packages/_pytest/runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.10/site-packages/_pytest/runner.py:255: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.10/site-packages/_pytest/runner.py:150: in pytest_runtest_setup
    item.session._setupstate.prepare(item)
/usr/lib/python3.10/site-packages/_pytest/runner.py:452: in prepare
    raise e
/usr/lib/python3.10/site-packages/_pytest/runner.py:449: in prepare
    col.setup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TestCaseFunction test_dummy>

    def setup(self) -> None:
        # A bound method to be called during teardown() if set (see 'runtest()').
        self._explicit_tearDown: Optional[Callable[[], None]] = None
        assert self.parent is not None
>       self._testcase = self.parent.obj(self.name)  # type: ignore[attr-defined]
E       TypeError: Test.__init__() takes 1 positional argument but 2 were given

/usr/lib/python3.10/site-packages/_pytest/unittest.py:194: TypeError
_______________________________________________________________________________________ ERROR at setup of InstBin.test_dummy ________________________________________________________________________________________

cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x7f5c191a25f0>, 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]":
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.10/site-packages/_pytest/runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.10/site-packages/_pytest/runner.py:255: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.10/site-packages/_pytest/runner.py:150: in pytest_runtest_setup
    item.session._setupstate.prepare(item)
/usr/lib/python3.10/site-packages/_pytest/runner.py:452: in prepare
    raise e
/usr/lib/python3.10/site-packages/_pytest/runner.py:449: in prepare
    col.setup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TestCaseFunction test_dummy>

    def setup(self) -> None:
        # A bound method to be called during teardown() if set (see 'runtest()').
        self._explicit_tearDown: Optional[Callable[[], None]] = None
        assert self.parent is not None
>       self._testcase = self.parent.obj(self.name)  # type: ignore[attr-defined]
E       TypeError: InstBin.__init__() missing 3 required positional arguments: 'mode', 'features', and 'address'

/usr/lib/python3.10/site-packages/_pytest/unittest.py:194: TypeError
_________________________________________________________________________________________ ERROR at setup of Inst.test_dummy _________________________________________________________________________________________

cls = <class '_pytest.runner.CallInfo'>, func = <function call_runtest_hook.<locals>.<lambda> at 0x7f5c18ae97e0>, 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]":
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

/usr/lib/python3.10/site-packages/_pytest/runner.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.10/site-packages/_pytest/runner.py:255: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3.10/site-packages/pluggy/hooks.py:286: in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:93: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
/usr/lib/python3.10/site-packages/pluggy/manager.py:84: in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/usr/lib/python3.10/site-packages/_pytest/runner.py:150: in pytest_runtest_setup
    item.session._setupstate.prepare(item)
/usr/lib/python3.10/site-packages/_pytest/runner.py:452: in prepare
    raise e
/usr/lib/python3.10/site-packages/_pytest/runner.py:449: in prepare
    col.setup()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <TestCaseFunction test_dummy>

    def setup(self) -> None:
        # A bound method to be called during teardown() if set (see 'runtest()').
        self._explicit_tearDown: Optional[Callable[[], None]] = None
        assert self.parent is not None
>       self._testcase = self.parent.obj(self.name)  # type: ignore[attr-defined]
E       TypeError: Inst.__init__() missing 3 required positional arguments: 'mode', 'instNo', and 'features'

/usr/lib/python3.10/site-packages/_pytest/unittest.py:194: TypeError
============================================================================================== short test summary info ==============================================================================================
ERROR python/test_distorm3.py::Test::test_dummy - TypeError: Test.__init__() takes 1 positional argument but 2 were given
ERROR python/test_distorm3.py::InstBin::test_dummy - TypeError: InstBin.__init__() missing 3 required positional arguments: 'mode', 'features', and 'address'
ERROR python/test_distorm3.py::Inst::test_dummy - TypeError: Inst.__init__() missing 3 required positional arguments: 'mode', 'instNo', and 'features'
=========================================================================================== 366 passed, 3 errors in 6.18s ==========================================================================================
@gdabah
Copy link
Owner

gdabah commented Jun 22, 2021

It seems latest Python 3 breaks testing?
I will try to reproduce in the weekend.

@trofi
Copy link
Author

trofi commented Jun 22, 2021

python-3.8 seems to fail the same. I ran tests with pytest (many python packages use pytest), is it a supported configuration? Looks like running the test file directly works without failures.

@gdabah
Copy link
Owner

gdabah commented Jun 22, 2021 via email

@gdabah gdabah closed this as completed Dec 18, 2021
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

2 participants