From 4c13fda47a96a4b66d55b9d366de1e86e5485f1a Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Thu, 26 Apr 2018 16:52:34 -0500 Subject: [PATCH] Set urlconf to None after changing SUBDOMAIN setting The urlconf value is preserved for the current thread, this causes errors when using the reverse function. --- readthedocs/rtd_tests/tests/test_subprojects.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/readthedocs/rtd_tests/tests/test_subprojects.py b/readthedocs/rtd_tests/tests/test_subprojects.py index 5e86fad0ef1..96487599a24 100644 --- a/readthedocs/rtd_tests/tests/test_subprojects.py +++ b/readthedocs/rtd_tests/tests/test_subprojects.py @@ -3,6 +3,7 @@ import mock import django_dynamic_fixture as fixture from django.contrib.auth.models import User +from django.core.urlresolvers import reverse, set_urlconf from django.test import TestCase from django.test.utils import override_settings @@ -185,6 +186,12 @@ def setUp(self): relation.save() fixture.get(Project, slug='sub_alias', language='ya') + def tearDown(self): + # The urlconf value is preserved for the current thread, + # (is modified to ``readthedocs.core.urls.subdomain``) + # this causes errors when using the reverse function. + # This method call deletes that setting. + set_urlconf(None) @override_settings( PRODUCTION_DOMAIN='readthedocs.org',