summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-02-23 21:40:31 -0500
committerChris McDonough <chrism@plope.com>2012-02-23 21:40:31 -0500
commit64c913abc0a23c4dcdbbce95be4459d664b78cbd (patch)
tree0980d75cf6486e379597c1deb6d6d2ccf9e91deb
parent3b9e5f1df23e42eabfc41e8726c27a7227230b61 (diff)
downloadpyramid-64c913abc0a23c4dcdbbce95be4459d664b78cbd.tar.gz
pyramid-64c913abc0a23c4dcdbbce95be4459d664b78cbd.tar.bz2
pyramid-64c913abc0a23c4dcdbbce95be4459d664b78cbd.zip
fixes #307
-rw-r--r--pyramid/tests/test_integration.py42
1 files changed, 25 insertions, 17 deletions
diff --git a/pyramid/tests/test_integration.py b/pyramid/tests/test_integration.py
index bf3bafc09..0d63b0b6b 100644
--- a/pyramid/tests/test_integration.py
+++ b/pyramid/tests/test_integration.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
import datetime
+import locale
import os
import unittest
@@ -15,6 +16,8 @@ from zope.interface import Interface
# 5 years from now (more or less)
fiveyrsfuture = datetime.datetime.utcnow() + datetime.timedelta(5*365)
+defaultlocale = locale.getdefaultlocale()[1]
+
class INothing(Interface):
pass
@@ -76,23 +79,25 @@ class TestStaticAppBase(IntegrationBase):
res = self.testapp.get('/static/.hiddenfile', status=200)
_assertBody(res.body, os.path.join(here, 'fixtures/static/.hiddenfile'))
- def test_highchars_in_pathelement(self):
- url = url_quote('/static/héhé/index.html')
- res = self.testapp.get(url, status=200)
- _assertBody(
- res.body,
- os.path.join(here,
- text_('fixtures/static/héhé/index.html', 'utf-8'))
- )
-
- def test_highchars_in_filename(self):
- url = url_quote('/static/héhé.html')
- res = self.testapp.get(url, status=200)
- _assertBody(
- res.body,
- os.path.join(here,
- text_('fixtures/static/héhé.html', 'utf-8'))
- )
+ if defaultlocale is not None:
+ # These tests are expected to fail on LANG=C systems
+ def test_highchars_in_pathelement(self):
+ url = url_quote('/static/héhé/index.html')
+ res = self.testapp.get(url, status=200)
+ _assertBody(
+ res.body,
+ os.path.join(here,
+ text_('fixtures/static/héhé/index.html', 'utf-8'))
+ )
+
+ def test_highchars_in_filename(self):
+ url = url_quote('/static/héhé.html')
+ res = self.testapp.get(url, status=200)
+ _assertBody(
+ res.body,
+ os.path.join(here,
+ text_('fixtures/static/héhé.html', 'utf-8'))
+ )
def test_not_modified(self):
self.testapp.extra_environ = {
@@ -611,5 +616,8 @@ def read_(filename):
return val
def _assertBody(body, filename):
+ if defaultlocale is None:
+ # If system locale does not have an encoding then default to utf-8
+ filename = filename.encode('utf-8')
assert(body.replace(b'\r', b'') == read_(filename))