|
1 | | -# Copyright 2019, OpenCensus Authors |
2 | | -# |
3 | | -# Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | -# you may not use this file except in compliance with the License. |
5 | | -# You may obtain a copy of the License at |
6 | | -# |
7 | | -# http://www.apache.org/licenses/LICENSE-2.0 |
8 | | -# |
9 | | -# Unless required by applicable law or agreed to in writing, software |
10 | | -# distributed under the License is distributed on an "AS IS" BASIS, |
11 | | -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | -# See the License for the specific language governing permissions and |
13 | | -# limitations under the License. |
| 1 | +# # Copyright 2019, OpenCensus Authors |
| 2 | +# # |
| 3 | +# # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# # you may not use this file except in compliance with the License. |
| 5 | +# # You may obtain a copy of the License at |
| 6 | +# # |
| 7 | +# # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# # |
| 9 | +# # Unless required by applicable law or agreed to in writing, software |
| 10 | +# # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# # See the License for the specific language governing permissions and |
| 13 | +# # limitations under the License. |
14 | 14 |
|
15 | | -import unittest |
| 15 | +# import unittest |
16 | 16 |
|
17 | | -import gevent.monkey |
18 | | -import mock |
| 17 | +# import gevent.monkey |
| 18 | +# import mock |
19 | 19 |
|
20 | | -import opencensus.common.runtime_context as runtime_context |
| 20 | +# import opencensus.common.runtime_context as runtime_context |
21 | 21 |
|
22 | 22 |
|
23 | | -class TestPatching(unittest.TestCase): |
24 | | - def setUp(self): |
25 | | - self.original_context = runtime_context.RuntimeContext |
| 23 | +# class TestPatching(unittest.TestCase): |
| 24 | +# def setUp(self): |
| 25 | +# self.original_context = runtime_context.RuntimeContext |
26 | 26 |
|
27 | | - def tearDown(self): |
28 | | - runtime_context.RuntimeContext = self.original_context |
| 27 | +# def tearDown(self): |
| 28 | +# runtime_context.RuntimeContext = self.original_context |
29 | 29 |
|
30 | | - @mock.patch("gevent.monkey.is_module_patched", return_value=False) |
31 | | - def test_context_is_switched_without_contextvar_support( |
32 | | - self, patched_is_module_patched |
33 | | - ): |
34 | | - # patched_is_module_patched.return_value = False |
| 30 | +# @mock.patch("gevent.monkey.is_module_patched", return_value=False) |
| 31 | +# def test_context_is_switched_without_contextvar_support( |
| 32 | +# self, patched_is_module_patched |
| 33 | +# ): |
| 34 | +# # patched_is_module_patched.return_value = False |
35 | 35 |
|
36 | | - # Trick gevent into thinking it is run for the first time. |
37 | | - # Allows to run multiple tests. |
38 | | - gevent.monkey.saved = {} |
| 36 | +# # Trick gevent into thinking it is run for the first time. |
| 37 | +# # Allows to run multiple tests. |
| 38 | +# gevent.monkey.saved = {} |
39 | 39 |
|
40 | | - # All module patching is disabled to avoid the need of "unpatching". |
41 | | - # The needed events are emitted nevertheless. |
42 | | - gevent.monkey.patch_all( |
43 | | - contextvar=False, |
44 | | - socket=False, |
45 | | - dns=False, |
46 | | - time=False, |
47 | | - select=False, |
48 | | - thread=False, |
49 | | - os=False, |
50 | | - ssl=False, |
51 | | - httplib=False, |
52 | | - subprocess=False, |
53 | | - sys=False, |
54 | | - aggressive=False, |
55 | | - Event=False, |
56 | | - builtins=False, |
57 | | - signal=False, |
58 | | - queue=False |
59 | | - ) |
| 40 | +# # All module patching is disabled to avoid the need of "unpatching". |
| 41 | +# # The needed events are emitted nevertheless. |
| 42 | +# gevent.monkey.patch_all( |
| 43 | +# contextvar=False, |
| 44 | +# socket=False, |
| 45 | +# dns=False, |
| 46 | +# time=False, |
| 47 | +# select=False, |
| 48 | +# thread=False, |
| 49 | +# os=False, |
| 50 | +# ssl=False, |
| 51 | +# httplib=False, |
| 52 | +# subprocess=False, |
| 53 | +# sys=False, |
| 54 | +# aggressive=False, |
| 55 | +# Event=False, |
| 56 | +# builtins=False, |
| 57 | +# signal=False, |
| 58 | +# queue=False |
| 59 | +# ) |
60 | 60 |
|
61 | | - assert isinstance( |
62 | | - runtime_context.RuntimeContext, |
63 | | - runtime_context._ThreadLocalRuntimeContext, |
64 | | - ) |
| 61 | +# assert isinstance( |
| 62 | +# runtime_context.RuntimeContext, |
| 63 | +# runtime_context._ThreadLocalRuntimeContext, |
| 64 | +# ) |
65 | 65 |
|
66 | | - @mock.patch("gevent.monkey.is_module_patched", return_value=True) |
67 | | - def test_context_is_switched_with_contextvar_support( |
68 | | - self, patched_is_module_patched |
69 | | - ): |
| 66 | +# @mock.patch("gevent.monkey.is_module_patched", return_value=True) |
| 67 | +# def test_context_is_switched_with_contextvar_support( |
| 68 | +# self, patched_is_module_patched |
| 69 | +# ): |
70 | 70 |
|
71 | | - # Trick gevent into thinking it is run for the first time. |
72 | | - # Allows to run multiple tests. |
73 | | - gevent.monkey.saved = {} |
| 71 | +# # Trick gevent into thinking it is run for the first time. |
| 72 | +# # Allows to run multiple tests. |
| 73 | +# gevent.monkey.saved = {} |
74 | 74 |
|
75 | | - # All module patching is disabled to avoid the need of "unpatching". |
76 | | - # The needed events are emitted nevertheless. |
77 | | - gevent.monkey.patch_all( |
78 | | - contextvar=False, |
79 | | - socket=False, |
80 | | - dns=False, |
81 | | - time=False, |
82 | | - select=False, |
83 | | - thread=False, |
84 | | - os=False, |
85 | | - ssl=False, |
86 | | - httplib=False, |
87 | | - subprocess=False, |
88 | | - sys=False, |
89 | | - aggressive=False, |
90 | | - Event=False, |
91 | | - builtins=False, |
92 | | - signal=False, |
93 | | - queue=False |
94 | | - ) |
| 75 | +# # All module patching is disabled to avoid the need of "unpatching". |
| 76 | +# # The needed events are emitted nevertheless. |
| 77 | +# gevent.monkey.patch_all( |
| 78 | +# contextvar=False, |
| 79 | +# socket=False, |
| 80 | +# dns=False, |
| 81 | +# time=False, |
| 82 | +# select=False, |
| 83 | +# thread=False, |
| 84 | +# os=False, |
| 85 | +# ssl=False, |
| 86 | +# httplib=False, |
| 87 | +# subprocess=False, |
| 88 | +# sys=False, |
| 89 | +# aggressive=False, |
| 90 | +# Event=False, |
| 91 | +# builtins=False, |
| 92 | +# signal=False, |
| 93 | +# queue=False |
| 94 | +# ) |
95 | 95 |
|
96 | | - assert runtime_context.RuntimeContext is self.original_context |
| 96 | +# assert runtime_context.RuntimeContext is self.original_context |
0 commit comments