When Using subtest, all subtest captured output is written into the Parent Output Property

オープン
#67 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

@BethanyG がすでに取り組んでいます。

2021年5月28日 から。

評価

この issue はまだ評価されていません。

説明

bug

If a user has used print() or other debugging methods in their code and the tests for that code are using unittest.subtest, the captured output for the subtests is being written into the parent output property in the results.json file -- one set of of output for each subtest. Not an ideal situation.

Steps to reproduce:

Using the tests/example-partial-failure-with-subtests/ test:

  1. Add print("User output is captured!") on line 8 of example_partial_failure_with_subtests.py
  2. Run ./bin/run.sh example-partial-failure-with-subtests
  3. Note that results.json has an entry that looks like this for ExampleSuccessTest.test_abc:
"name": "ExampleSuccessTest.test_abc",
      "status": "pass",
      "test_code": "input_data = ['frog', 'fish', 'coconut', 'pineapple', 'carrot', 'cucumber', 'grass', 'tree']\nresult_data = [(\"Hello, World!\", param) for param in input_data]\nnumber_of_variants = range(1, len(input_data) + 1)\n\nfor variant, param, result in zip(number_of_variants, input_data, result_data):\n    with self.subTest(f\"variation #{variant}\", param=param, result=result):\n        self.assertEqual(hello(param), result,",
      "task_id": 1,
      "output": "User output is captured!\nUser output is captured!\nUser output is captured!\nUser output is captured!\nUser output is captured!\nUser output is captured!\nUser output is captured!\nUser output is captured!"
    }

Ideally, we'd write captured output for a subtest into the output property for that subtest. In cases where there is not a subtest report (pytest only reports failed subtests), we would annotate the parent test output to indicate it came from a successful subtest.

主要言語
Python
スター
13
フォーク
20
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

exercism/python-test-runner のほかの issue

exercism/python-test-runner の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。