diff options
| author | Chris McDonough <chrism@plope.com> | 2012-02-28 01:34:24 -0500 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2012-02-28 01:34:24 -0500 |
| commit | e6d802ce67205464263e0eda224bdd723796d23b (patch) | |
| tree | 8dba3b540f2394130b94dac65bb569438d8a52dd | |
| parent | 006274146137aecd2dde8919123d04776a5872c6 (diff) | |
| download | pyramid-e6d802ce67205464263e0eda224bdd723796d23b.tar.gz pyramid-e6d802ce67205464263e0eda224bdd723796d23b.tar.bz2 pyramid-e6d802ce67205464263e0eda224bdd723796d23b.zip | |
hail mary windows
| -rw-r--r-- | pyramid/tests/test_config/test_assets.py | 21 | ||||
| -rw-r--r-- | pyramid/tests/test_integration.py | 3 |
2 files changed, 14 insertions, 10 deletions
diff --git a/pyramid/tests/test_config/test_assets.py b/pyramid/tests/test_config/test_assets.py index 627eefba7..e39d72d45 100644 --- a/pyramid/tests/test_config/test_assets.py +++ b/pyramid/tests/test_config/test_assets.py @@ -163,9 +163,8 @@ class TestOverrideProvider(unittest.TestCase): import pyramid.tests.test_config provider = self._makeOne(pyramid.tests.test_config) 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(b'\r', b''), expected) + _assertBody(result.read(), os.path.join(here, resource_name)) def test_get_resource_string_no_overrides(self): import os @@ -173,9 +172,8 @@ class TestOverrideProvider(unittest.TestCase): import pyramid.tests.test_config provider = self._makeOne(pyramid.tests.test_config) 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(b'\r', b''), expected) + _assertBody(result, os.path.join(here, resource_name)) def test_has_resource_no_overrides(self): resource_name = 'test_assets.py' @@ -221,9 +219,8 @@ class TestOverrideProvider(unittest.TestCase): import pyramid.tests.test_config provider = self._makeOne(pyramid.tests.test_config) 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(), expected) + _assertBody(result.read(), os.path.join(here, resource_name)) def test_get_resource_string_override_returns_None(self): overrides = DummyOverrides(None) @@ -420,10 +417,8 @@ class TestPackageOverrides(unittest.TestCase): po = self._makeOne(package) po.overrides= overrides 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(b'\r', b''), - expected) + _assertBody(stream.read(), os.path.join(here, 'test_assets.py')) def test_get_stream_file_doesnt_exist(self): overrides = [ DummyOverride(None), DummyOverride( @@ -595,3 +590,11 @@ def read_(src): contents = f.read() return contents +def _assertBody(body, filename): + # strip both \n and \r for windows + body = body.replace(b'\\r', b'') + body = body.replace(b'\\n', b'') + data = read_(filename) + data = data.replace(b'\\r', b'') + data = data.replace(b'\\n', b'') + assert(body == data) diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py index 37be4701a..68a145b77 100644 --- a/pyramid/tests/test_integration.py +++ b/pyramid/tests/test_integration.py @@ -11,7 +11,6 @@ from pyramid.static import static_view from pyramid.compat import ( text_, url_quote, - WIN, ) from zope.interface import Interface @@ -623,5 +622,7 @@ def _assertBody(body, filename): body = body.replace(b'\\r', b'') body = body.replace(b'\\n', b'') data = read_(filename) + data = data.replace(b'\\r', b'') + data = data.replace(b'\\n', b'') assert(body == data) |
