VS Code compatibility help

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

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python, vscode

调研方向

首先查看 issue 中描述的 pytest_exception_interact hook 行为,包括 node.execution_count、marker kwargs 和 report._rerun。将这些值与 VS Code 扩展的结果和异常 payload 流程进行比较;完成的标准是确定应如何区分 rerun 失败和最终失败,并记录适当的兼容性变更。

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

描述

Hi! I am the maintainer of testing in the Python extension for VS Code. I was doing a review of top pytest extensions to check their compatibility with the extension. I tried pytest-rerunfailures and found it didn't work correctly in the case that the test failed, then later passed. Instead of showing the test as passing, it only took the first failure and displayed that in the UI. I am looking for advice on how to make sure the plugin works correctly- below I explain a bit about how the extension works and hopefully that can give you enough context to provide some advice. Thanks!

Pytest in the Python extension works with a custom pytest plugin for VS Code. In this plugin it collects test results after each test runs and sends a payload back to the main extension host to display to the user (this allows for dynamic run, where the results come in as they finish instead of all at the end of the entire run). The extension also sends back payloads on exceptions, which includes the def pytest_exception_interact(node, call, report): hook from pytest.

What I am noticing as I am testing with the pytest-rerunfailures plugin is that a test which fails once, but still can rerun, calls the hook def pytest_exception_interact(node, call, report):. From my investigation it seems that the node.execution_count variable keeps track of how many times that test has run. Then if the rerun value is set via a pytest marker, the max attempts can be found in the marker kwargs or if the reruns are defined from the command line argument it is stored on the _rerun attribute on report.

The best solution I can determine right nwo is to not send the failure to the extension if the def pytest_exception_interact(node, call, report): is called when the node.execution_count < max_attempts, but the max attempts can be defined a few different ways. Is this the correct way to handle this situation and the best way to check to see if the given test has more reruns to execute?

Sorry for the long explanation and please let me know what other information I can provide for clarity. If you are not familiar, you can try testing in VS Code by clicking on the "beaker" icon in the sidebar of VS Code and from there you can setup testing with pytest. I appreciate your help as I try and get the best experience for this plugin in VS Code! Thanks

主要语言
Python
星标
481
派生
110
PR 合并指标
30 天内没有已合并 PR

环境准备

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

从这里开始

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

pytest-dev/pytest-rerunfailures 的其他 Issue

查看 pytest-dev/pytest-rerunfailures 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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