scipy / scipy_doctest

Floating-point aware doctesting
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Configure doctest options through DTConfig #81

Closed Sheila-nk closed 1 year ago

ev-br commented 1 year ago

Several things to investigate:

Sheila-nk commented 1 year ago

@ev-br

can we tack a DTConfig instance to pytest's own config object?

You were right about this, it's only a single line of code for each attribute:

def pytest_configure(config):
    """
    Allow plugins and conftest files to perform initial configuration.
    """
    config.nameerror_after_exception = dt_config.nameerror_after_exception
    config.user_context_mgr = dt_config.user_context_mgr

then you can pass the config instance wherever. I have tried it and it works.

ev-br commented 1 year ago

I think it's safer to have a dt_config attribute of pytest config object

Sheila-nk commented 1 year ago

Hmmm, not sure I understand. Like this?

config.dt_config = dt_config
ev-br commented 1 year ago

Indeed! This way, in the pytest layer there is only pytest config, in the doctesting layer, there is only DTConfig.