Fix TestCase loading with nested classes
- Lingua principale
- Python
- Stelle
- 149
- Fork
- 62
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
TestSlide loads TestCase classes using [this logic](https://github.com/facebookincubator/TestSlide/blob/b2d2ef9c288082b476332938bfc1d486abb0137e/testslide/cli.py#L59-L63). Upstream Python, does it [like this](https://github.com/python/cpython/blob/fd628cf5adaeee73eab579393cdff71c8f70cdf2/Lib/unittest/loader.py#L121-L124). This means, that If the module has this:
```python
class Outer:
class Inner(TestCase):
def test_something(self):
pass
```
Python won't consider `Inner.test_something` as part of the test, but TestSlide will.
This can be easily fixed by refactoring the logic at TestSlide's side to match Python's, however, it won't cover other cases such as [`load_tests()`](https://github.com/python/cpython/blob/fd628cf5adaeee73eab579393cdff71c8f70cdf2/Lib/unittest/loader.py#L126-L130).
The proper fix for this, is to use Python's [`TestLoader`](https://github.com/python/cpython/blob/fd628cf5adaeee73eab579393cdff71c8f70cdf2/Lib/unittest/loader.py#L66) in the same fashion as Python unittent [does form its CLI](https://github.com/python/cpython/blob/fd628cf5adaeee73eab579393cdff71c8f70cdf2/Lib/unittest/main.py#L156).
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.