summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2011-09-24 05:06:24 -0400
committerChris McDonough <chrism@plope.com>2011-09-24 05:06:24 -0400
commitf12147b76adefb2c70fd7ae453a71f8206793e7d (patch)
treedc62b2b58a35b15325ab52ce9022a2ff135c4ec0
parente0549d7bafa289cb01efe00eb7a904035806013d (diff)
downloadpyramid-f12147b76adefb2c70fd7ae453a71f8206793e7d.tar.gz
pyramid-f12147b76adefb2c70fd7ae453a71f8206793e7d.tar.bz2
pyramid-f12147b76adefb2c70fd7ae453a71f8206793e7d.zip
fix asset tests on py3
-rw-r--r--pyramid/tests/test_config/test_assets.py9
-rw-r--r--pyramid/tests/test_integration.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/pyramid/tests/test_config/test_assets.py b/pyramid/tests/test_config/test_assets.py
index 876a921b4..8d9ab5825 100644
--- a/pyramid/tests/test_config/test_assets.py
+++ b/pyramid/tests/test_config/test_assets.py
@@ -165,7 +165,7 @@ class TestOverrideProvider(unittest.TestCase):
here = os.path.dirname(os.path.abspath(__file__))
expected = read_(os.path.join(here, resource_name))
with provider.get_resource_stream(None, resource_name) as result:
- self.assertEqual(result.read().replace('\r', ''), expected)
+ self.assertEqual(result.read().replace(b'\r', b''), expected)
def test_get_resource_string_no_overrides(self):
import os
@@ -175,7 +175,7 @@ class TestOverrideProvider(unittest.TestCase):
here = os.path.dirname(os.path.abspath(__file__))
expected = read_(os.path.join(here, resource_name))
result = provider.get_resource_string(None, resource_name)
- self.assertEqual(result.replace('\r', ''), expected)
+ self.assertEqual(result.replace(b'\r', b''), expected)
def test_has_resource_no_overrides(self):
resource_name = 'test_assets.py'
@@ -422,7 +422,7 @@ class TestPackageOverrides(unittest.TestCase):
here = os.path.dirname(os.path.abspath(__file__))
expected = read_(os.path.join(here, 'test_assets.py'))
with po.get_stream('whatever') as stream:
- self.assertEqual(stream.read().replace('\r', ''),
+ self.assertEqual(stream.read().replace(b'\r', b''),
expected)
def test_get_stream_file_doesnt_exist(self):
@@ -442,7 +442,8 @@ class TestPackageOverrides(unittest.TestCase):
po.overrides= overrides
here = os.path.dirname(os.path.abspath(__file__))
expected = read_(os.path.join(here, 'test_assets.py'))
- self.assertEqual(po.get_string('whatever').replace('\r', ''), expected)
+ self.assertEqual(po.get_string('whatever').replace(b'\r', b''),
+ expected)
def test_get_string_file_doesnt_exist(self):
overrides = [ DummyOverride(None), DummyOverride(
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py
index ca6301105..381d52aae 100644
--- a/pyramid/tests/test_integration.py
+++ b/pyramid/tests/test_integration.py
@@ -191,7 +191,7 @@ class TestStaticAppNoSubpath(unittest.TestCase):
def _assertBody(self, body, filename):
self.assertEqual(
- body.replace(r'\r', r''),
+ body.replace(b'\r', b''),
open(filename, 'rb').read()
)