Commit e71f3362 authored by Alex Gaynor's avatar Alex Gaynor
Browse files

Fixed the humanize tests to work properly with a pure-python datetime module...

Fixed the humanize tests to work properly with a pure-python datetime module (platforms such as PyPy)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17144 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 8ddecc39
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
from __future__ import with_statement

import datetime
import new

from django.template import Template, Context, defaultfilters
from django.test import TestCase
@@ -182,12 +184,13 @@ class HumanizeTests(TestCase):
        from django.contrib.humanize.templatetags import humanize
        from django.utils import timesince
        orig_humanize_datetime = humanize.datetime
        orig_timesince_datetime = timesince.datetime.datetime
        orig_timesince_datetime = timesince.datetime
        humanize.datetime = MockDateTime
        timesince.datetime = new.module("mock_datetime")
        timesince.datetime.datetime = MockDateTime

        try:
            self.humanize_tester(test_list, result_list, 'naturaltime')
        finally:
            humanize.datetime = orig_humanize_datetime
            timesince.datetime.datetime = orig_timesince_datetime
            timesince.datetime = orig_timesince_datetime