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

未关闭
#287 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@jiasli 已经在做这个了。

开始于 2024年7月16日。

  • #288 来自 @jiasli —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python
领域
cli, testing-qa

调研方向

首先检查 examples/test_exapp 和 ScenarioTest 类,然后将示例重命名为 examples/test_exapp.py,并使用 pytest 重现该故障。当示例能够在没有因缺少 method_name 而导致的 TypeError 的情况下被收集并运行时,工作即完成。

由索引模型根据 Issue 内容生成。

描述

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 ===================================================
主要语言
Python
星标
359
派生
104
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/knack 的其他 Issue

查看 microsoft/knack 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。