microsoft / microsoft/knack

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

Open
#287 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
358
Forks
101
PR merge metrics
No merged PRs in 30d

Description

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 ===================================================

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting examples/test_exapp and the ScenarioTest class, then reproduce the failure with pytest after renaming the example to examples/test_exapp.py. The work is done when the example can be collected and run without the missing method_name TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.