Closed Sheila-nk closed 1 year ago
@ev-br Should this context manager: warnings_errors_and_rng be copied to scpdt's util.py module?
Not sure. This looks somewhat scipy-specific. If the tool itself is meant to be cross-project, why others need to know about scipy-specific names and exceptions?
Off the cuff, this looks like a material for project-specific conftest.py (or however other means of project-specific configuration). WDYT?
That is true. I think we will know for sure if we need to implement a project-agnostic version of this after the integration.
We do want a project-agnostic version + a clear way to add project specifics.
Okay, I think this is my next task then.
@ev-br I've noticed that this context manager is a combination of scpdt util's scipy_rndm_state and warnings_errors context managers but with a known_warnings
dictionary for warnings that should be ignored.
So my goal is to ensure projects can use this context manager by specifying their own list of functions whose warnings should be ignored?
The goal is that projects can specify the context where their doctests are run. This may or may not include warnings->errors, manipulations of the random state etc etc. This is up to a project.
What the cross-project tool needs to do is:
cf https://github.com/ev-br/scpdt/blob/main/scpdt/frontend.py#L247
EDIT: Maybe this logic needs to live in the runner which is responsible for actually running tests. Or an autofixture.
https://github.com/scipy/scipy/blob/5b4b3ec030f4d27f6bb1b4c4ec53a92f83e648ef/tools/doctest_public_modules.py#L54