New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] @reverse_lazy doesn't get evaluated without settings.using_env #1087
Comments
There appears to be a similarly related timing bug, I can't use a lazily evaluated value inside of @pytest.mark.parametrize(
("expected_url"),
[settings.LOGIN_URL)],
)
def test_url(expected_url):
assert expected_url == "/admin/login/" |
Hey, thanks for the investigation and the reproduction, I'll try to have a look into this. |
I have a theory.
Then, if somehow we make dynaconf re-execute the loaders, the @reverse_lazy will take effect because it will be present on loading time. The My first thought for approaching this is implementing a pre-hook and calling it before the loaders execution. |
Describe the bug
To be honest, it's not entirely clear to me where the bug is, or how I'm hitting it. But I was able to reproduce this with #1086. It appears that the custom converted (added with
add_converter
forreverse_lazy
) doesn't end up getting evaluated until after awith settings.using_env()
gets applied.So, the tests, evaluating
self.assertEqual(settings.LOGIN_URL, "/admin/login/")
, works at the bottom of the test (after runningwith settings.using_env()
, but if it's tested at the top of the test (before anywith settings.using_env()
statements) it fails.I really don't know why this is, but I'm seeing the same behavior in my own repo (which is what prompted me to start digging).
Environment (please complete the following information):
master
master
here)The text was updated successfully, but these errors were encountered: