Skip to content
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

Tests that modify settings and render pages fail on Django 3+ #1989

Closed
jerivas opened this issue Jun 1, 2021 · 2 comments
Closed

Tests that modify settings and render pages fail on Django 3+ #1989

jerivas opened this issue Jun 1, 2021 · 2 comments

Comments

@jerivas
Copy link
Collaborator

jerivas commented Jun 1, 2021

The test test_login_required is currently failing at the point where settings are overridden:

with override_settings(LOGIN_URL="login"):
    # Note: The "login" is a pattern name in accounts.urls.
    response = self.client.get(public_url, follow=True) # <------------------ Fails here
    self.assertEqual(response.status_code, 200)
    response = self.client.get(private_url, follow=True)
    self.assertRedirects(response, login)
mezzanine/template/__init__.py:53: in render
    context[parts[-1]] = tag_func(*args, **kwargs)
mezzanine/twitter/templatetags/twitter_tags.py:63: in tweets_default
    query_type = settings.TWITTER_DEFAULT_QUERY_TYPE
mezzanine/conf/__init__.py:259: in __getattr__
    editable_cache = self._get_editable(request=self._current_request)
mezzanine/conf/__init__.py:163: in _get_editable
    editable_settings = self._editable_caches[request]
mezzanine/conf/__init__.py:254: in __getattr__
    return getattr(django_settings, name)
.tox/py39-dj30/lib/python3.9/site-packages/django/conf/__init__.py:77: in __getattr__
    val = getattr(self._wrapped, name)
.tox/py39-dj30/lib/python3.9/site-packages/django/conf/__init__.py:204: in __getattr__
    raise AttributeError
E   AttributeError

From my investigation it looks like when get is called the twitter_default tag is called somewhere in the template, which in turns reads from the settings, and that crashes the site witn an AttributeError for TWITTER_DEFAULT_QUERY_TYPE. It seems to me override_settings is breaking Mezzanine's editable settings machinery (specifically the _editable_caches mentioned in the traceback).

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 5.0.0-rc.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant