Fix tests in the app engine sandbox

This commit is contained in:
Ben Darnell 2015-10-18 21:39:43 +02:00
parent 7a0b4aab6c
commit 4747c95a9d
3 changed files with 14 additions and 2 deletions

View File

@ -50,7 +50,14 @@ except NameError:
# 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():

View File

@ -7,7 +7,7 @@ import tempfile
import tornado.locale
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
@ -37,6 +37,8 @@ class TranslationLoaderTest(unittest.TestCase):
self.assertTrue(isinstance(locale, tornado.locale.CSVLocale))
self.assertEqual(locale.translate("school"), u("\u00e9cole"))
# tempfile.mkdtemp is not available on app engine.
@skipOnAppEngine
def test_csv_bom(self):
with open(os.path.join(os.path.dirname(__file__), 'csv_translations',
'fr_FR.csv'), 'rb') as f:

View File

@ -26,6 +26,9 @@ skipIfNonUnix = unittest.skipIf(os.name != 'posix' or sys.platform == 'cygwin',
skipOnTravis = unittest.skipIf('TRAVIS' in os.environ,
'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
# depend on an external network.
skipIfNoNetwork = unittest.skipIf('NO_NETWORK' in os.environ,