File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -44,3 +44,44 @@ def test_something_else():
4444
4545 result = testdir .runpytest_subprocess ()
4646 assert result .ret == 0
47+
48+
49+ def test_urls_cache_is_cleared_and_new_urls_can_be_assigned (testdir ):
50+ testdir .makepyfile (myurls = """
51+ from django.conf.urls import url
52+ from pytest_django_test.compat import patterns
53+
54+ def fake_view(request):
55+ pass
56+
57+ urlpatterns = patterns('', url(r'first/$', fake_view, name='first'))
58+ """ )
59+
60+ testdir .makepyfile (myurls2 = """
61+ from django.conf.urls import url
62+ from pytest_django_test.compat import patterns
63+
64+ def fake_view(request):
65+ pass
66+
67+ urlpatterns = patterns('', url(r'second/$', fake_view, name='second'))
68+ """ )
69+
70+ testdir .makepyfile ("""
71+ from django.core.urlresolvers import reverse, NoReverseMatch
72+ import pytest
73+
74+ @pytest.mark.urls('myurls')
75+ def test_something():
76+ reverse('first')
77+
78+ @pytest.mark.urls('myurls2')
79+ def test_something_else():
80+ with pytest.raises(NoReverseMatch):
81+ reverse('first')
82+
83+ reverse('second')
84+ """ )
85+
86+ result = testdir .runpytest_subprocess ()
87+ assert result .ret == 0
You can’t perform that action at this time.
0 commit comments