Fix tests in the app engine sandbox
This commit is contained in:
parent
7a0b4aab6c
commit
4747c95a9d
|
@ -50,7 +50,14 @@ except NameError:
|
||||||
|
|
||||||
|
|
||||||
# Re-export this exception for convenience.
|
# Re-export this exception for convenience.
|
||||||
CalledProcessError = subprocess.CalledProcessError
|
try:
|
||||||
|
CalledProcessError = subprocess.CalledProcessError
|
||||||
|
except AttributeError:
|
||||||
|
# The subprocess module exists in Google App Engine, but is empty.
|
||||||
|
# This module isn't very useful in that case, but it should
|
||||||
|
# at least be importable.
|
||||||
|
if 'APPENGINE_RUNTIME' not in os.environ:
|
||||||
|
raise
|
||||||
|
|
||||||
|
|
||||||
def cpu_count():
|
def cpu_count():
|
||||||
|
|
|
@ -7,7 +7,7 @@ import tempfile
|
||||||
|
|
||||||
import tornado.locale
|
import tornado.locale
|
||||||
from tornado.escape import utf8, to_unicode
|
from tornado.escape import utf8, to_unicode
|
||||||
from tornado.test.util import unittest
|
from tornado.test.util import unittest, skipOnAppEngine
|
||||||
from tornado.util import u, unicode_type
|
from tornado.util import u, unicode_type
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ class TranslationLoaderTest(unittest.TestCase):
|
||||||
self.assertTrue(isinstance(locale, tornado.locale.CSVLocale))
|
self.assertTrue(isinstance(locale, tornado.locale.CSVLocale))
|
||||||
self.assertEqual(locale.translate("school"), u("\u00e9cole"))
|
self.assertEqual(locale.translate("school"), u("\u00e9cole"))
|
||||||
|
|
||||||
|
# tempfile.mkdtemp is not available on app engine.
|
||||||
|
@skipOnAppEngine
|
||||||
def test_csv_bom(self):
|
def test_csv_bom(self):
|
||||||
with open(os.path.join(os.path.dirname(__file__), 'csv_translations',
|
with open(os.path.join(os.path.dirname(__file__), 'csv_translations',
|
||||||
'fr_FR.csv'), 'rb') as f:
|
'fr_FR.csv'), 'rb') as f:
|
||||||
|
|
|
@ -26,6 +26,9 @@ skipIfNonUnix = unittest.skipIf(os.name != 'posix' or sys.platform == 'cygwin',
|
||||||
skipOnTravis = unittest.skipIf('TRAVIS' in os.environ,
|
skipOnTravis = unittest.skipIf('TRAVIS' in os.environ,
|
||||||
'timing tests unreliable on travis')
|
'timing tests unreliable on travis')
|
||||||
|
|
||||||
|
skipOnAppEngine = unittest.skipIf('APPENGINE_RUNTIME' in os.environ,
|
||||||
|
'not available on Google App Engine')
|
||||||
|
|
||||||
# Set the environment variable NO_NETWORK=1 to disable any tests that
|
# Set the environment variable NO_NETWORK=1 to disable any tests that
|
||||||
# depend on an external network.
|
# depend on an external network.
|
||||||
skipIfNoNetwork = unittest.skipIf('NO_NETWORK' in os.environ,
|
skipIfNoNetwork = unittest.skipIf('NO_NETWORK' in os.environ,
|
||||||
|
|
Loading…
Reference in New Issue