
1. Modules in oslo_service uses eventlet, but they are not monkey_patched. This patch add monkey_patch to all unittest code. The original unittest code does not really work, it muddles through. 2. According to what Elena Ezhova said, there is a bug about patching os module on windows [1]. As a result, the monkey patch bypass os module on windows. 3. subprocess module is not monkey_patched by default, we should use eventlet.green.subprocess explicitly. 4. test_stop_immediately() does not work as expected, the reason it passes is because foo() never get a change to run, if foo get a change to run, the blocking version time.sleep() in it will block the main thread. We should give it a chance to run so that the test counts. [1] https://bitbucket.org/eventlet/eventlet/issues/132/eventletmonkey_patch-breaks Change-Id: Ic586be571b78fc096f77aadc6c9f3c85e4f26c80 Signed-off-by: apporc <appleorchard2000@gmail.com>
28 lines
989 B
Python
28 lines
989 B
Python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import os
|
|
|
|
import eventlet
|
|
|
|
if os.name == 'nt':
|
|
# eventlet monkey patching the os and thread modules causes
|
|
# subprocess.Popen to fail on Windows when using pipes due
|
|
# to missing non-blocking IO support.
|
|
#
|
|
# bug report on eventlet:
|
|
# https://bitbucket.org/eventlet/eventlet/issue/132/
|
|
# eventletmonkey_patch-breaks
|
|
eventlet.monkey_patch(os=False, thread=False)
|
|
else:
|
|
eventlet.monkey_patch()
|