facebook / facebook/TestSlide

Can't configure TestCase

Abierto
#48 1 comentario 0 reacciones 0 asignados Ver en GitHub
enhancement help wanted Python Unittest
Lenguaje dominante
Python
Estrellas
149
Forks
62
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.