facebook / facebook/TestSlide

Can't configure TestCase

未关闭
#48 1 条评论 0 个 reaction 已指派 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 摘要。