Closed Sheila-nk closed 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.
I think it's safer to have a dt_config attribute of pytest config object
Hmmm, not sure I understand. Like this?
config.dt_config = dt_config
Indeed! This way, in the pytest layer there is only pytest config, in the doctesting layer, there is only DTConfig.
Several things to investigate:
conftest.py
or some other way?DTConfig
instance to pytest's ownconfig
object? The latter is being passed around by pytest anyway, so would be nice to use it.