Closed
Description
It may be easier to have an app settings structure like this to avoid modifying sys.modules[__name__] = Settings()
(see 5.0's settings) as this adds complexity to imports, preventing simplification of maintenance / testing / etc #136
poetry run py.test ============================ test session starts ============================= collected 0 items / 1 error =================================== ERRORS =================================== __________________ ERROR collecting src/robots/settings.py ___________________ .venv/lib/python3.10/site-packages/_pytest/runner.py:338: in from_call result: Optional[TResult] = func() cls = <class '_pytest.runner.CallInfo'> duration = 0.0004884000009042211 excinfo = <ExceptionInfo ImportPathMismatchError('robots.settings', None, PosixPath('~/work/python/django-robots/src/robots/settings.py')) tblen=4> func = <function pytest_make_collect_report.<locals>.<lambda> at 0x7f95b64d1480> precise_start = 43076.9144613 precise_stop = 43076.9149497 reraise = None result = None start = 1665841416.0452023 stop = 1665841416.045692 when = 'collect' .venv/lib/python3.10/site-packages/_pytest/runner.py:369: in <lambda> call = CallInfo.from_call(lambda: list(collector.collect()), "collect") collector = <DoctestModule settings.py> .venv/lib/python3.10/site-packages/_pytest/doctest.py:545: in collect module = import_path( MockAwareDocTestFinder = <class '_pytest.doctest.DoctestModule.collect.<locals>.MockAwareDocTestFinder'> doctest = <module 'doctest' from '~/.python/installs/python/3.10.7/lib/python3.10/doctest.py'> self = <DoctestModule settings.py> .venv/lib/python3.10/site-packages/_pytest/pathlib.py:543: in import_path
raise ImportPathMismatchError(module_name, module_file, path)
E _pytest.pathlib.ImportPathMismatchError: ('robots.settings', None, PosixPath('~/work/python/django-robots/src/robots/settings.py')) ignore = ''
mod = <robots.settings.Settings object at 0x7f95b6133f10>
mode = <ImportMode.prepend: 'prepend'>
module_file = None
module_name = 'robots.settings'
names = ['robots', 'settings']
p = PosixPath('~/work/python/django-robots/src/robots/settings.py')
path = PosixPath('~/work/python/django-robots/src/robots/settings.py')
pkg_path = PosixPath('~/work/python/django-robots/src/robots')
pkg_root = PosixPath('~/work/python/django-robots/src')
root = PosixPath('~/work/python/django-robots')
========================== short test summary info =========================== ERROR src/robots/settings.py - _pytest.pathlib.ImportPathMismatchError: ('r...
!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!
============================== 1 error in 0.20s ==============================
make[1]: *** [Makefile:24: test] Error 2
make[1]: Leaving directory '~/work/python/django-robots'
make[1]: Entering directory '~/work/python/django-robots'
poetry run py.test
============================ test session starts =============================
collected 0 items / 4 errors
Metadata
Metadata
Assignees
Labels
No labels