Skip to content

Broken examples/test_exapp: TypeError: ScenarioTest.__init__() missing 1 required positional argument: 'method_name' #287

@jiasli

Description

@jiasli

First of all, examples/test_exapp cannot be directly executed by pytest.

> pytest examples\test_exapp
================================================= test session starts =================================================
platform win32 -- Python 3.11.9, pytest-8.2.2, pluggy-1.5.0
rootdir: D:\cli\knack
plugins: forked-1.6.0, xdist-3.6.1
collected 0 items

================================================ no tests ran in 0.02s ================================================
ERROR: not found: D:\cli\knack\examples\test_exapp
(no match in any of [<Dir examples>])

After renaming it to test_exapp.py. pytest fails with

> pytest examples\test_exapp.py
================================================= test session starts =================================================
platform win32 -- Python 3.11.9, pytest-8.2.2, pluggy-1.5.0
rootdir: D:\cli\knack
plugins: forked-1.6.0, xdist-3.6.1
collected 3 items / 1 error

======================================================= ERRORS ========================================================
_______________________________________ ERROR collecting examples/test_exapp.py _______________________________________
..\py311\Lib\site-packages\_pytest\runner.py:341: in from_call
    result: Optional[TResult] = func()
..\py311\Lib\site-packages\_pytest\runner.py:389: in collect
    return list(collector.collect())
..\py311\Lib\site-packages\_pytest\unittest.py:90: in collect
    self.session._fixturemanager.parsefactories(self.newinstance(), self.nodeid)
..\py311\Lib\site-packages\_pytest\unittest.py:75: in newinstance
    return self.obj("runTest")
E   TypeError: ScenarioTest.__init__() missing 1 required positional argument: 'method_name'
=============================================== short test summary info ===============================================
ERROR examples/test_exapp.py::ScenarioTest - TypeError: ScenarioTest.__init__() missing 1 required positional argument: 'method_name'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================== 1 error in 0.96s ===================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions