facebook / facebook/TestSlide

Can't configure TestCase

Đang mở
#48 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement help wanted Python Unittest
Ngôn ngữ chính
Python
Star
149
Fork
62
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.