Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Test compatible with Python 3

  • Loading branch information...
commit 53691e54a821baa227caff4a5fc96e43eb2ddbcd 1 parent a3ea593
Tatiana Al-Chueyr authored

Showing 1 changed file with 19 additions and 8 deletions. Show diff stats Hide diff stats

  1. 27  tests/test_tornado_cors.py
27  tests/test_tornado_cors.py
... ...
@@ -1,6 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 import imp
3 3
 import functools
  4
+import sys
4 5
 
5 6
 from tornado.testing import AsyncHTTPTestCase
6 7
 from tornado.web import Application, asynchronous, RequestHandler
@@ -60,19 +61,29 @@ def tearDown(self):
60 61
         custom_decorator.wrapper = self.original_wrapper
61 62
 
62 63
     def test_wrapper_customization(self):
63  
-        # assert default wrapper is being used
64  
-        wrapper_module_name = cors.CorsMixin.options.im_func.func_code.co_filename
65  
-        self.assertFalse(passed_by_custom_wrapper)
66  
-        self.assertTrue(wrapper_module_name.endswith("tornado/web.py"))
  64
+        version = sys.version_info[0]
  65
+        if version == 2:
  66
+            # assert default wrapper is being used        
  67
+            wrapper_module_name = cors.CorsMixin.options.im_func.func_code.co_filename
  68
+            self.assertFalse(passed_by_custom_wrapper)
  69
+            self.assertTrue(wrapper_module_name.endswith("tornado/web.py"))
  70
+
  71
+        self.assertEquals(cors.custom_decorator.wrapper, asynchronous)
67 72
 
68 73
         # overwrite using custom wrapper and reload module
69 74
         custom_decorator.wrapper = custom_wrapper
70 75
         imp.reload(cors)
71 76
 
72  
-        # assert new wrapper is being used
73  
-        wrapper_module_name = cors.CorsMixin.options.im_func.func_code.co_filename
74  
-        self.assertTrue(passed_by_custom_wrapper)
75  
-        self.assertTrue(wrapper_module_name.endswith("tests/test_tornado_cors.py"))
  77
+        if version == 2:
  78
+            # assert new wrapper is being used
  79
+            wrapper_module_name = cors.CorsMixin.options.im_func.func_code.co_filename
  80
+            self.assertTrue(passed_by_custom_wrapper)
  81
+            self.assertTrue(wrapper_module_name.endswith("tests/test_tornado_cors.py"))
  82
+        
  83
+        self.assertEquals(cors.custom_decorator.wrapper, custom_wrapper)
  84
+
  85
+
  86
+
76 87
 
77 88
 
78 89
 class DefaultValuesHandler(cors.CorsMixin, RequestHandler):

0 notes on commit 53691e5

Please sign in to comment.
Something went wrong with that request. Please try again.