facebook/TestSlide

Fix TestCase loading with nested classes

Open

#51 geöffnet am 27. Sept. 2019

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (58 Forks)auto 404
Python Unittestbughelp wanted

Repository-Metriken

Stars
 (147 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

TestSlide loads TestCase classes using this logic. Upstream Python, does it like this. This means, that If the module has this:

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().

The proper fix for this, is to use Python's TestLoader in the same fashion as Python unittent does form its CLI.

Contributor Guide