[Python-modules-commits] r21382 - in packages/python-django-localeurl/trunk/debian (4 files)

janos-guest at users.alioth.debian.org janos-guest at users.alioth.debian.org
Mon Apr 23 15:22:45 UTC 2012


    Date: Monday, April 23, 2012 @ 15:22:43
  Author: janos-guest
Revision: 21382

Fix test for Django 1.4 (Closes: #669484)

Added:
  packages/python-django-localeurl/trunk/debian/patches/
  packages/python-django-localeurl/trunk/debian/patches/fix-tests-for-django-1.4.patch
  packages/python-django-localeurl/trunk/debian/patches/series
Modified:
  packages/python-django-localeurl/trunk/debian/changelog

Modified: packages/python-django-localeurl/trunk/debian/changelog
===================================================================
--- packages/python-django-localeurl/trunk/debian/changelog	2012-04-23 14:58:20 UTC (rev 21381)
+++ packages/python-django-localeurl/trunk/debian/changelog	2012-04-23 15:22:43 UTC (rev 21382)
@@ -1,9 +1,11 @@
 python-django-localeurl (1.5-2) unstable; urgency=low
 
+  * Add patches/fix-tests-for-django-1.4.patch (Closes: #669484)
+    - Fix tests for Django 1.4.
   * Add DM-Upload-Allowed control field.
   * Fix dep5 syntax.
 
- -- Janos Guljas <janos at resenje.org>  Sun, 11 Dec 2011 15:41:53 +0100
+ -- Janos Guljas <janos at resenje.org>  Mon, 23 Apr 2012 17:00:40 +0200
 
 python-django-localeurl (1.5-1) unstable; urgency=low
 

Added: packages/python-django-localeurl/trunk/debian/patches/fix-tests-for-django-1.4.patch
===================================================================
--- packages/python-django-localeurl/trunk/debian/patches/fix-tests-for-django-1.4.patch	                        (rev 0)
+++ packages/python-django-localeurl/trunk/debian/patches/fix-tests-for-django-1.4.patch	2012-04-23 15:22:43 UTC (rev 21382)
@@ -0,0 +1,61 @@
+Description: Fix tests for Django 1.4.
+Author: Carl Meyer <carl at oddbird.net>
+Last-Update: 2012-01-31
+
+
+diff -r ab067c22e92a48cc26bd8cefea41bb4804c0f990 -r 8e600e6b30cf6c0de88f0416b2b519cb1a81eca3 localeurl/tests/test_utils.py
+--- a/localeurl/tests/test_utils.py	Tue Jan 31 14:39:52 2012 -0700
++++ b/localeurl/tests/test_utils.py	Tue Jan 31 14:40:05 2012 -0700
+@@ -2,6 +2,10 @@
+ Test utilities.
+ 
+ """
++try:
++    from cStringIO import StringIO
++except ImportError:
++    from StringIO import StringIO
+ 
+ from django.conf import settings as django_settings
+ from django.core.handlers.wsgi import WSGIRequest
+@@ -50,6 +54,26 @@
+ 
+ 
+ 
++class FakePayload(object):
++    """
++    A wrapper around StringIO that restricts what can be read since data from
++    the network can't be seeked and cannot be read outside of its content
++    length. This makes sure that views can't do anything under the test client
++    that wouldn't work in Real Life.
++    """
++    def __init__(self, content):
++        self.__content = StringIO(content)
++        self.__len = len(content)
++
++    def read(self, num_bytes=None):
++        if num_bytes is None:
++            num_bytes = self.__len or 0
++        assert self.__len >= num_bytes, "Cannot read more than the available bytes from the HTTP incoming data."
++        content = self.__content.read(num_bytes)
++        self.__len -= num_bytes
++        return content
++
++
+ class RequestFactory(Client):
+     """
+     Class that lets you create mock Request objects for use in testing.
+@@ -83,6 +107,13 @@
+             'SERVER_NAME': 'testserver',
+             'SERVER_PORT': 80,
+             'SERVER_PROTOCOL': 'HTTP/1.1',
++            'wsgi.version':      (1,0),
++            'wsgi.url_scheme':   'http',
++            'wsgi.input':        FakePayload(''),
++            'wsgi.errors':       self.errors,
++            'wsgi.multiprocess': True,
++            'wsgi.multithread':  False,
++            'wsgi.run_once':     False,
+         }
+         environ.update(self.defaults)
+         environ.update(request)
+

Added: packages/python-django-localeurl/trunk/debian/patches/series
===================================================================
--- packages/python-django-localeurl/trunk/debian/patches/series	                        (rev 0)
+++ packages/python-django-localeurl/trunk/debian/patches/series	2012-04-23 15:22:43 UTC (rev 21382)
@@ -0,0 +1 @@
+fix-tests-for-django-1.4.patch




More information about the Python-modules-commits mailing list