Skip to content

RFE: provide command line option to finish pytest script with exit 0 when there is no units #9976

@kloczek

Description

@kloczek

What's the problem this feature will solve?

Sometimes it is helpful to be able to finish pytest script execution if pytest was not able to find any units.

Describe the solution you'd like

Add th new --exit-0-if-no-units command-line option to allow finish with exit 0 if pytest cannot find any units.

I'm packaging python modules as rpm/Solaris IPS package. Part of the build procedure is obligatory execution available test suite. I have now +930 such packages, and for about 1/9 it is not possible to use pytest because there is no pytest support in the module code.

[tkloczko@devel-g2v SPECS]$ grep ^%pytest python-* | wc -l; grep ^%tox python-* | wc -l; grep ^%py3_test python-*|wc -l; ls -1 python-* | wc -l
830
1
27
933

I'm trying to reach the goal of having 100% of modules tested using pytest.
The obstacle on the road to that goal is that pytest scripts finish with a non-zero exit code when there is no units.
It would pytest command-line option to allow to finish pytest exit 0 if pytest could not find any units.

Use case for such cmd line option would be spread everywhere %pytest --exit-0-if-no-units in case of those modules where pytest is not able to find units.
That command line option would create a kind of base platform for the mass test of al module with redefined %ptest macro with additional --black, --cov or --flake8 switches to assess which one of the modules are passing the test of some extensions and present a public ranking of all modules compliant with exact additional tests.
In spec file would be something like

%check
%pytest --exit-0-if-no-units

This would also be a clear indicator that the exact module has no units.

Additional context

I don't think that such functionality should be possible to handle by some pytest.ini entry.
IMO the best would be to have only the command line option.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions