Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Improved our tests so that they don't raise an error if setuptools is…

…n't installed, hence ridding the test suite of all dependencies. Also updated docs.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7751 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 65437a95e146a90d74686eb4414f1a210cbac0fe 1 parent 345a096
Adrian Holovaty authored June 26, 2008
6  docs/contributing.txt
@@ -747,10 +747,8 @@ dependencies:
747 747
     *  Docutils_
748 748
     *  setuptools_
749 749
 
750  
-Of these dependencies, setuptools_ is the only dependency that is required. If
751  
-setuptools_ is not installed, you'll get import errors when running one of
752  
-the template tests. The tests using the other dependencies will be skipped if the
753  
-particular library can't be found.
  750
+Each of these dependencies is optional. If you're missing any of them, the
  751
+associated tests will be skipped.
754 752
 
755 753
 .. _PyYAML: http://pyyaml.org/wiki/PyYAML
756 754
 .. _Markdown: http://pypi.python.org/pypi/Markdown/1.7
19  tests/regressiontests/templates/tests.py
@@ -20,7 +20,10 @@
20 20
 from unicode import unicode_tests
21 21
 from context import context_tests
22 22
 
23  
-from loaders import *
  23
+try:
  24
+    from loaders import *
  25
+except ImportError:
  26
+    pass # If setuptools isn't installed, that's fine. Just move on.
24 27
 
25 28
 import filters
26 29
 
@@ -539,13 +542,13 @@ def get_template_tests(self):
539 542
             'if-tag-error05': ("{% if not foo or %}yes{% else %}no{% endif %}", {'foo': True}, template.TemplateSyntaxError),
540 543
 
541 544
             ### IFCHANGED TAG #########################################################
542  
-            'ifchanged01': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', { 'num': (1,2,3) }, '123'),
543  
-            'ifchanged02': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', { 'num': (1,1,3) }, '13'),
544  
-            'ifchanged03': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', { 'num': (1,1,1) }, '1'),
545  
-            'ifchanged04': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% endfor %}{% endfor %}', { 'num': (1, 2, 3), 'numx': (2, 2, 2)}, '122232'),
546  
-            'ifchanged05': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% endfor %}{% endfor %}', { 'num': (1, 1, 1), 'numx': (1, 2, 3)}, '1123123123'),
547  
-            'ifchanged06': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% endfor %}{% endfor %}', { 'num': (1, 1, 1), 'numx': (2, 2, 2)}, '1222'),
548  
-            'ifchanged07': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% for y in numy %}{% ifchanged %}{{ y }}{% endifchanged %}{% endfor %}{% endfor %}{% endfor %}', { 'num': (1, 1, 1), 'numx': (2, 2, 2), 'numy': (3, 3, 3)}, '1233323332333'),
  545
+            'ifchanged01': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', {'num': (1,2,3)}, '123'),
  546
+            'ifchanged02': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', {'num': (1,1,3)}, '13'),
  547
+            'ifchanged03': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% endfor %}', {'num': (1,1,1)}, '1'),
  548
+            'ifchanged04': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% endfor %}{% endfor %}', {'num': (1, 2, 3), 'numx': (2, 2, 2)}, '122232'),
  549
+            'ifchanged05': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% endfor %}{% endfor %}', {'num': (1, 1, 1), 'numx': (1, 2, 3)}, '1123123123'),
  550
+            'ifchanged06': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% endfor %}{% endfor %}', {'num': (1, 1, 1), 'numx': (2, 2, 2)}, '1222'),
  551
+            'ifchanged07': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% for y in numy %}{% ifchanged %}{{ y }}{% endifchanged %}{% endfor %}{% endfor %}{% endfor %}', {'num': (1, 1, 1), 'numx': (2, 2, 2), 'numy': (3, 3, 3)}, '1233323332333'),
549 552
 
550 553
             # Test one parameter given to ifchanged.
551 554
             'ifchanged-param01': ('{% for n in num %}{% ifchanged n %}..{% endifchanged %}{{ n }}{% endfor %}', { 'num': (1,2,3) }, '..1..2..3'),

0 notes on commit 65437a9

Please sign in to comment.
Something went wrong with that request. Please try again.