From aea7627eb033d15f9eeccb0b576032119a1c03dc Mon Sep 17 00:00:00 2001 From: dengzhaosen Date: Tue, 27 Apr 2021 15:32:50 +0800 Subject: [PATCH] Remove references to 'sys.version_info' We support Python 3.6 as a minimum now, making these checks no-ops. Change-Id: Ibaa2cdb7cc27f541aeb778782813354df2911156 --- oslo_service/service.py | 7 +++---- oslo_service/tests/test_service.py | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/oslo_service/service.py b/oslo_service/service.py index c9d6bd0b..fa9c37c2 100644 --- a/oslo_service/service.py +++ b/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: diff --git a/oslo_service/tests/test_service.py b/oslo_service/tests/test_service.py index 58be122b..fad33e93 100644 --- a/oslo_service/tests/test_service.py +++ b/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