]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix tests in the app engine sandbox
authorBen Darnell <ben@bendarnell.com>
Sun, 18 Oct 2015 19:39:43 +0000 (21:39 +0200)
committerBen Darnell <ben@bendarnell.com>
Sun, 18 Oct 2015 19:52:17 +0000 (21:52 +0200)
tornado/process.py
tornado/test/locale_test.py
tornado/test/util.py

index f580e19253340ac892f502043ad7bf4cacdbfd0a..daa9677bb500af3cadc3a06fc7a043611d063841 100644 (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():
index 44726644d2b1e6785dd3a71e09cacd1975e9a5f6..e25783861eb824e5bb8a8e7648d8de83fbe32a24 100644 (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:
index b8feff4fa91c115344e63ca723e84c084b25a896..cfa7c81d21cb6b8d6433167a935e214f82067677 100644 (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,