Skip to content

FR: Revert pytest.warns(None) changes #9402

@bashtage

Description

@bashtage

What's the problem this feature will solve?

I need to dynamically catch warnings where whether the warning is issued or not depends on information that is only available at runtime.

Describe the solution you'd like

Accept pytest.warns(None) as equivalent to pytest.warns() without error

warn_typ = FutureWarning if dt_s_tup[0] == "nc" else None

model = VAR(endog, exog)
with pytest.warns(warn_typ):
    results_per_deterministic_terms[dt_s_tup] = model.fit(
        maxlags=4, trend=dt_s_tup[0], method="ols"
    )

from

https://github.com/statsmodels/statsmodels/blob/948bfc4520791b2d867829259367f446bd107218/statsmodels/tsa/vector_ar/tests/test_var_jmulti.py#L133-L139

Alternative Solutions

I don't see any workaround. As far as I know there is not easy way to work around this. Is the solution to use an empty *args expansion?

This removal seems to have missed the relative challenge of calling a function with 1 argument vs 0 arguments.

Additional context

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