pytest: TestCase failures reported as passing
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- testing-qa
調査の方向性
示されている TestCase の例と ciqueue.pytest_report プラグインコマンドを使って問題を再現します。Issue で参照されている pytest unittest hook と ciqueue の reporting hook を読み、それらの順序と call.excinfo の扱いを確認します。失敗する TestCase が passed ではなく failed として報告されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
With this test suite:
# test_example.py
from unittest import TestCase
class TestExample(TestCase):
def test_fail(self):
assert False
Running works as expected:
$ pytest -p ciqueue.pytest --queue 'redis://localhost:6379/0?worker=0&build=repro&retry=0&timeout=10' test_example.py
========================================================= test session starts =========================================================
platform darwin -- Python 2.7.13, pytest-4.0.1, py-1.7.0, pluggy-0.6.0
...
collected 1 item
test_example.py F
============================================================== FAILURES ===============================================================
________________________________________________________ TestExample.test_fail ________________________________________________________
self = <test_example.TestExample testMethod=test_fail>
def test_fail(self):
> assert False
E AssertionError: assert False
test_example.py:5: AssertionError
====================================================== 1 failed in 0.06 seconds =======================================================
However, reporting shows that the test passed:
$ pytest -p ciqueue.pytest_report --queue 'redis://localhost:6379/0?worker=0&build=repro&retry=0&timeout=10' test_example.py
========================================================= test session starts =========================================================
platform darwin -- Python 2.7.13, pytest-4.0.1, py-1.7.0, pluggy-0.6.0
...
collected 1 item
test_example.py . [100%]
====================================================== 1 passed in 0.02 seconds =======================================================
This appears to be due to ciqueue's makereport triggering before the one in pytest which is responsible for setting call.excinfo for TestCase-style tests.
From these docs it looks like:
- the ordering of multiple
tryfirst=Truehooks is undefined hookwrapper=Truecan execute code before atryfirsthook
So, one fix could be to get pytest to switch to using hookwrapper. I figured I'd raise it with you folks first, though, in case it's something that's easier to fix on this end (by making ciqueue execute later, somehow).
- 主要言語
- Ruby
- スター
- 240
- フォーク
- 36
- 平均マージ
- 28分
- マージ済み PR(30日)
- 3
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/ci-queue のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
Shopify/ci-queue の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
simp/pupmod-simp-simp#395 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
simp/pupmod-simp-rsyslog#219 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
simp/pupmod-simp-pupmod#256 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
simp/pupmod-simp-sudo#150 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100