facebook / facebook/TestSlide

Can't configure TestCase

オープン
#48 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement help wanted Python Unittest
主要言語
Python
スター
149
フォーク
62
PR マージ指標
30日以内にマージされた PR はありません

説明

TestSlide has a [hacky](https://github.com/facebookincubator/TestSlide/blob/b3be3931178ae03eeae858a6ff6dca36ac8f131b/testslide/__init__.py#L93,L130) support for [`TestCase.assert*` methods](https://testslide.readthedocs.io/en/1.5.0/testslide_dsl/unittest_testcase_integration/index.html#assertions). While this works, it prevents users from tweaking things such as [`maxDiff`](https://docs.python.org/3.4/library/unittest.html#unittest.TestCase.maxDiff).

The proposed solution to fix this is:

- Drop the hacky `self._test_case`.
- Make usage of the [`TestCase integration`](https://testslide.readthedocs.io/en/1.5.0/testslide_dsl/unittest_testcase_integration/index.html#reusing-existing-unittest-testcase-setup), perhaps by adding doing [`self.add_test_case()`](https://github.com/facebookincubator/TestSlide/blob/b3be3931178ae03eeae858a6ff6dca36ac8f131b/testslide/__init__.py#L648) at [`Context.__init__`](https://github.com/facebookincubator/TestSlide/blob/b3be3931178ae03eeae858a6ff6dca36ac8f131b/testslide/__init__.py#L394), and assigning it to `self.test_case`.
- Keep the [`__getattr__`](https://github.com/facebookincubator/TestSlide/blob/b3be3931178ae03eeae858a6ff6dca36ac8f131b/testslide/__init__.py#L130) logic, but forward it to `self.test_case`.

With that, users should be able to do `self.test_case.maxDiff = new_value`.

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

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

評価

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

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

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