teemtee / tmt

Test Management Tool
MIT License
86 stars 130 forks source link

Wrong indentation of output #2307

Closed thrix closed 1 year ago

thrix commented 1 year ago

In the current main the last plan is indented wrongly if I run this command:

❯ tmt run test --name /tests/test/check
/var/home/mvadkert/.local/share/tmt/run-097

/plans/features/advanced
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tier: 4
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/features/basic
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tier: 2
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/features/core
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tier: 0, 1
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/features/steps/discover
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tier: 3
        tests: ^/tests/discover
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/features/steps/execute
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tier: 3
        tests: ^/tests/execute
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/features/steps/prepare
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tier: 3
        tests: ^/tests/prepare
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/features/steps/the-rest
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tier: 3
        tests: ^/tests/(?!discover|prepare|execute)
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/integration
    discover
        how: fmf
        directory: /var/home/mvadkert/git/github.com/tmt
        filter: tag: integration
        summary: 0 tests selected
        warning: No tests found, finishing plan.

/plans/sanity/lint
    discover
        how: shell
        summary: 0 tests selected
        warning: No tests found, finishing plan.

    /plans/remote/polarion
        discover
            how: fmf
            directory: /var/home/mvadkert/.local/share/tmt/run-097/import/plans/remote/polarion
            filter: tag: integration
            summary: 0 tests selected
            warning: No tests found, finishing plan.

total: no results found
thrix commented 1 year ago

@happz not sure when this happened

happz commented 1 year ago

This seems to be as old as 1.22 :) It does not appear before, it starts appearing in 1.22.0, but it might be related to the plan alone - if I limit plans with plan -n feature, the last plan is not indented.

I think it's not about being last, but what the plan contains:

$ cat plans/remote/polarion.fmf 
/:
    inherit: false
plan:
    import:
        url: https://github.com/teemtee/tests
        name: /plans/polarion

The /: plus top-level plan is probably messing with indentation.

thrix commented 1 year ago

interesting :)

therazix commented 1 year ago

The problem is probably with imported plans. https://github.com/teemtee/tmt/blob/acc601ba15da0fe7f58314017f16f4626122ab67/tmt/base.py#L2318 Indentation is shifted by logger.descend() method.

I created a PR that should fix this.