summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-02-28 00:13:13 -0500
committerChris McDonough <chrism@plope.com>2012-02-28 00:13:13 -0500
commit8064bd5edb0ac8442aaf96946f85caf599dd213d (patch)
treef0891f86e96bac205dc625c166b749ae9adce6e0
parent1ca9703d8b815db21e9011b5d5187d18704152fe (diff)
downloadpyramid-8064bd5edb0ac8442aaf96946f85caf599dd213d.tar.gz
pyramid-8064bd5edb0ac8442aaf96946f85caf599dd213d.tar.bz2
pyramid-8064bd5edb0ac8442aaf96946f85caf599dd213d.zip
fix a few tests on windows, might fail on unix now, but i have to check in to find out
-rw-r--r--pyramid/compat.py6
-rw-r--r--pyramid/tests/test_integration.py2
-rw-r--r--pyramid/tests/test_url.py12
3 files changed, 15 insertions, 5 deletions
diff --git a/pyramid/compat.py b/pyramid/compat.py
index 948a1c3be..51d7456f3 100644
--- a/pyramid/compat.py
+++ b/pyramid/compat.py
@@ -1,6 +1,12 @@
+import platform
import sys
import types
+if platform.system() == 'Windows':
+ WIN = True
+else:
+ WIN = False
+
try: # pragma: no cover
import __pypy__
PYPY = True
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py
index 85a68ab25..a9f0688ab 100644
--- a/pyramid/tests/test_integration.py
+++ b/pyramid/tests/test_integration.py
@@ -613,7 +613,7 @@ def httpdate(ts):
return ts.strftime("%a, %d %b %Y %H:%M:%S GMT")
def read_(filename):
- with open(filename, 'rb') as fp:
+ with open(filename, 'r') as fp:
val = fp.read()
return val
diff --git a/pyramid/tests/test_url.py b/pyramid/tests/test_url.py
index 7f002cbd6..d71bc7854 100644
--- a/pyramid/tests/test_url.py
+++ b/pyramid/tests/test_url.py
@@ -1,3 +1,4 @@
+import os
import unittest
import warnings
@@ -8,6 +9,7 @@ from pyramid.testing import (
from pyramid.compat import (
text_,
native_,
+ WIN,
)
class TestURLMethodsMixin(unittest.TestCase):
@@ -516,7 +518,7 @@ class TestURLMethodsMixin(unittest.TestCase):
abspath = makeabs('static', 'foo.css')
result = request.static_url(abspath)
self.assertEqual(result, 'abc')
- self.assertEqual(info.args, ('/static/foo.css', request, {}))
+ self.assertEqual(info.args, (makeabs('static', 'foo.css'), request, {}))
request = self._makeOne()
def test_static_url_found_rel(self):
@@ -576,7 +578,7 @@ class TestURLMethodsMixin(unittest.TestCase):
abspath = makeabs('static', 'foo.css')
result = request.static_path(abspath)
self.assertEqual(result, 'abc')
- self.assertEqual(info.args, ('/static/foo.css', request,
+ self.assertEqual(info.args, (makeabs('static', 'foo.css'), request,
{'_app_url':'/foo'})
)
@@ -986,5 +988,7 @@ class DummyStaticURLInfo:
return self.result
def makeabs(*elements):
- import os
- return os.path.sep + os.path.sep.join(elements)
+ if WIN:
+ return r'c:\\' + os.path.sep.join(elements)
+ else:
+ return os.path.sep + os.path.sep.join(elements)