You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and got Argument(s) {'settings', 'tmp_path'} are declared in the hookimpl but can not be found in the hookspec
With session scoped fixtures I got error lik ScopeMismatch: You tried to access the function scoped fixtures settings, tmp_path with a session scoped request object, involved factories:
So, would like to know how can I achieve my goals.
The text was updated successfully, but these errors were encountered:
settings.TEMPLATES, post-initialization is effectively immutable.
Editing settings.TEMPLATES directly before rendering won't change what views use EngineHandler (its cached library/registry object)
I went from directly use DJANGO_SETTINGS_MODULE to going to pytest_configure to initialize settings, and I found that I can't use DIRS + tmp_path derived fixtures when running settings.configure().
The only choice may end up being having pre-determined .gitignore'd / temporary directory for writing temporary files to, but it may not end up being pytest's own temporary directory fixtures.
I ran into this just now.
My niche anecdote with TEMPLATES
I've found a problem that resolves my issue. I had imports of settings in my project like form settings_folder import settings. So, when I imported them directly like that, I didn't have patched settings by pytest-django.
So, I have few strings in settings.py like
I use them in few parts of my app. When I created test, I wanted to patch them by manual like
But it does nothing because settings attributes where already imported before running a code from test, if I understand correct.
I tried to use
and got
Argument(s) {'settings', 'tmp_path'} are declared in the hookimpl but can not be found in the hookspec
With session scoped fixtures I got error lik
ScopeMismatch: You tried to access the function scoped fixtures settings, tmp_path with a session scoped request object, involved factories:
So, would like to know how can I achieve my goals.
The text was updated successfully, but these errors were encountered: