pchomik / pytest-spec

Library pytest-spec is a pytest plugin to display test execution output like a SPECIFICATION.
GNU General Public License v2.0
100 stars 19 forks source link

convert title cased class names to sentence #46

Open satyanash opened 3 years ago

satyanash commented 3 years ago

If I have a test nested inside a class:

class TestFoobar:
  class TestWhenFooIsBar:
    def test_it_should_do_something():
      assert 1 == 1

It should convert the class name to a sentence When Foo Is Bar as follows :

Foobar:
  When Foo Is Bar:
    ✓ it should do something:

Right now, it simply outs it as as it is: WhenFooIsBar. A temporary workaround could be #44, but even that requires double work to add docstrings when your class names may already be descriptive enough.

0x64746b commented 2 years ago

Fwiw, splitting non-nested, top-level class names once worked but apparently broke with https://github.com/pchomik/pytest-spec/pull/18/files#diff-70bfff549b1975eda90e09b38b990f495ad9d24c3899ced8e49f3cf418a43634L72 🤷