You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ===================================================
The text was updated successfully, but these errors were encountered:
jiasli
changed the title
Broken examples/test_exapp
Broken examples/test_exapp: TypeError: ScenarioTest.__init__() missing 1 required positional argument: 'method_name'
Jul 16, 2024
I think the reason for the TypeError: ScenarioTest.__init__() missing 1 required positional argument: 'method_name' error is related to pytest-dev/pytest#12289.
As ScenarioTest is imported into examples/test_exapp:
pytest treats ScenarioTest as a normal test class and calls its __init__ with method_name="runTest". However, knack.testsdk.base.ScenarioTest.__init__ requires 2 positional arguments:
First of all,
examples/test_exapp
cannot be directly executed bypytest
.After renaming it to
test_exapp.py
.pytest
fails withThe text was updated successfully, but these errors were encountered: