Skip to content

Option to use counter instead of percentage for progress #3829

@DanaGoyette

Description

@DanaGoyette

With pytest (I'm currently using 3.6.1), there's support for showing progress of tests, but when running a collection of 1300 tests, each test contributes very little to the percentage. I'd prefer to be able to show the bare counter. Example (with space padding): test_whatever [ 1/1357]

In my framework, I'm monkey-patching pytest to get what I want, but it would be more maintainable if pytest supported that style officially.

My current monkey-patch:

    def _get_progress(self):
        """
        Report progress in number of tests, not percentage.
        Since we have thousands of tests, 1% is still several tests.
        """
        collected = self._session.testscollected
        self._PROGRESS_LENGTH = len(' [%d/%d]' % (collected, collected))
        if collected:
            spacing = len(str(collected))
            current = len(self._progress_nodeids_reported)
            fmt = ' [{:%sd}/{}]' % spacing
            return fmt.format(current, collected)
        return ' []'

    TerminalReporter._PROGRESS_LENGTH = len(' [9999/9999]')
    TerminalReporter._get_progress_information_message = _get_progress

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wanteddevelopers would like help from experts on this topictype: enhancementnew feature or API change, should be merged into features branchtype: feature-branchnew feature or API change, should be merged into features branchtype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions