Browse Source

Remove references to 'sys.version_info'

We support Python 3.6 as a minimum now, making these checks no-ops.

Change-Id: Ibaa2cdb7cc27f541aeb778782813354df2911156
changes/90/788190/4
dengzhaosen 3 months ago
parent
commit
aea7627eb0
  1. 7
      oslo_service/service.py
  2. 2
      oslo_service/tests/test_service.py

7
oslo_service/service.py

@ -197,12 +197,11 @@ class SignalHandler(metaclass=Singleton):
def __setup_signal_interruption(self):
"""Set up to do the Right Thing with signals during poll() and sleep().
For Python 3.5 and later, deal with the changes in PEP 475 that prevent
a signal from interrupting eventlet's call to poll() or sleep().
Deal with the changes introduced in PEP 475 that prevent a signal from
interrupting eventlet's call to poll() or sleep().
"""
select_module = eventlet.patcher.original('select')
self.__force_interrupt_on_signal = (sys.version_info >= (3, 5) and
hasattr(select_module, 'poll'))
self.__force_interrupt_on_signal = hasattr(select_module, 'poll')
if self.__force_interrupt_on_signal:
try:

2
oslo_service/tests/test_service.py

@ -476,7 +476,6 @@ class ProcessLauncherTest(base.ServiceBaseTestCase):
m.assert_called_once_with(signal.SIGTERM, 'test')
signal_handler.clear()
@mock.patch('sys.version_info', (3, 5))
def test_setup_signal_interruption_no_select_poll(self):
# NOTE(claudiub): SignalHandler is a singleton, which means that it
# might already be initialized. We need to clear to clear the cache
@ -490,7 +489,6 @@ class ProcessLauncherTest(base.ServiceBaseTestCase):
self.assertFalse(
signal_handler._SignalHandler__force_interrupt_on_signal)
@mock.patch('sys.version_info', (3, 5))
def test_setup_signal_interruption_select_poll(self):
# NOTE(claudiub): SignalHandler is a singleton, which means that it
# might already be initialized. We need to clear to clear the cache

Loading…
Cancel
Save