diff options
| author | Chris McDonough <chrism@plope.com> | 2011-10-02 20:00:36 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-10-02 20:00:36 -0400 |
| commit | 64aaf0076c774ec194dded87038df7b513c1ffc0 (patch) | |
| tree | b96e5b76c1cfdf8ff652d65698cfed4c6f115750 | |
| parent | f32f32c18d3cc153e495787f34753f50aa6045ba (diff) | |
| download | pyramid-64aaf0076c774ec194dded87038df7b513c1ffc0.tar.gz pyramid-64aaf0076c774ec194dded87038df7b513c1ffc0.tar.bz2 pyramid-64aaf0076c774ec194dded87038df7b513c1ffc0.zip | |
make pass on 32-bit systems
| -rw-r--r-- | pyramid/tests/test_integration.py | 9 | ||||
| -rw-r--r-- | pyramid/tests/test_static.py | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index 0c17b88ce..2210f8fff 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import datetime import os import unittest @@ -11,6 +12,9 @@ from pyramid.compat import url_quote from zope.interface import Interface +# 5 years from now (more or less) +fiveyrsfuture = datetime.datetime.utcnow() + datetime.timedelta(5*365) + class INothing(Interface): pass @@ -92,7 +96,7 @@ class TestStaticAppBase(IntegrationBase): def test_not_modified(self): self.testapp.extra_environ = { - 'HTTP_IF_MODIFIED_SINCE':httpdate(pow(2, 32)-1)} + 'HTTP_IF_MODIFIED_SINCE':httpdate(fiveyrsfuture)} res = self.testapp.get('/minimal.pt', status=304) self.assertEqual(res.body, b'') @@ -574,7 +578,8 @@ class DummyRequest: def httpdate(ts): import datetime - ts = datetime.datetime.utcfromtimestamp(ts) + if isinstance(ts, int): + ts = datetime.datetime.utcfromtimestamp(ts) return ts.strftime("%a, %d %b %Y %H:%M:%S GMT") def read_(filename): diff --git a/pyramid/tests/test_static.py b/pyramid/tests/test_static.py index 9fdf29637..a04a47397 100644 --- a/pyramid/tests/test_static.py +++ b/pyramid/tests/test_static.py @@ -1,5 +1,9 @@ +import datetime import unittest +# 5 years from now (more or less) +fiveyrsfuture = datetime.datetime.utcnow() + datetime.timedelta(5*365) + class Test_static_view_use_subpath_False(unittest.TestCase): def _getTargetClass(self): from pyramid.static import static_view @@ -138,7 +142,7 @@ class Test_static_view_use_subpath_False(unittest.TestCase): def test_resource_notmodified(self): inst = self._makeOne('pyramid.tests:fixtures/static') request = self._makeRequest({'PATH_INFO':'/index.html'}) - request.if_modified_since = pow(2, 32) -1 + request.if_modified_since = fiveyrsfuture context = DummyContext() response = inst(context, request) start_response = DummyStartResponse() @@ -303,7 +307,7 @@ class Test_static_view_use_subpath_True(unittest.TestCase): def test_resource_notmodified(self): inst = self._makeOne('pyramid.tests:fixtures/static') request = self._makeRequest() - request.if_modified_since = pow(2, 32) -1 + request.if_modified_since = fiveyrsfuture request.subpath = ('index.html',) context = DummyContext() response = inst(context, request) |
