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

[Bug?] Output is not nested properly #28

Closed paxcodes closed 4 years ago

paxcodes commented 4 years ago

To reproduce

class TestWhenUserDidThis:
    class TestAndAlsoDidThis:
        def test_it_happened(self):
            assert True

    class TestAndUserDidNotDoThis:
        def test_it_did_not_happen(self):
            assert True

class TestWhenUserDidThat:
    class TestAndAlsoDidThisOtherThing:
        def test_it_happened(self):
            assert True

Expected Output

Based on https://github.com/pchomik/pytest-spec/pull/18, it should be nested like this: (notice that "AndUserDidNotDoThis" is nested under "WhenUserDidThis"

  When user did this:
    And also did this:
    ✓ It happened

    And user did not do this:
    ✓ It did not happen

  When user did that:
    And also did this other thing:
    ✓ It happened      

Actual Output

Notice that "AndUserDidNotDoThis" is not nested under "WhenUserDidThis" and the test class names weren't converted to normal case.

  WhenUserDidThis:
    AndAlsoDidThis:
    ✓ It happened

  AndUserDidNotDoThis:
    ✓ It did not happen

  WhenUserDidThat:
    AndAlsoDidThisOtherThing:
    ✓ It happened