Skip to content

@pytest.mark.xfail is being applied too broadly #4425

Closed
@ricardoV94

Description

@ricardoV94

When working in https://github.com/pymc-devs/pymc3/blob/master/pymc3/tests/test_distributions.py in #4421 I noticed that several of the @pytest.mark.xfail are being applied to more than one function at a time, usually to the pymc3_matches_scipy and the check_logcdf (and also entirely due to my fault in #4393, the new check_selfconsistency_discrete_logcdf).

I don't know if the xfail is clever enough to evaluate each subfunction separately or if it is enough if one fails. Even if pytest counts each (surprising) successful subfunction as an additional xpass, I don't think people pay much attention to these and we may not notice if their behavior changes in the future.

Here is one concrete example:

https://github.com/pymc-devs/pymc3/blob/6360b005fc610d0505f84885743215a3e09f046e/pymc3/tests/test_distributions.py#L1258-L1278

From this PR https://github.com/pymc-devs/pymc3/pull/3944/files

It seems that xfail was added to the test_inverse_gamma when the check_logcdf method was added, and it was not necessary when only the pymc3_matches_scipy was being tested. If the behavior of the logp of the Gamma changes in the future (albheit in a contrived scenario that only fails in float32), we would miss it.

Metadata

Metadata

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions