mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-05 03:37:01 +00:00
[PR #11048/ebf45260 backport][stable-12] remove conditional code for old snakes (#11050)
remove conditional code for old snakes (#11048)
* remove conditional code for old snakes
* remove conditional code for old snakes
* reformat
* add changelog frag
(cherry picked from commit ebf45260ce)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
16f1d07509
commit
caebf65948
17 changed files with 26 additions and 105 deletions
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from collections import OrderedDict
|
||||
from unittest.mock import patch, MagicMock, Mock
|
||||
|
|
@ -13,14 +12,10 @@ from ansible.playbook.task import Task
|
|||
from ansible.executor.task_result import TaskResult
|
||||
from ansible_collections.community.general.plugins.callback.elastic import ElasticSource, TaskData
|
||||
|
||||
ELASTIC_MINIMUM_PYTHON_VERSION = (3, 6)
|
||||
|
||||
|
||||
class TestOpentelemetry(unittest.TestCase):
|
||||
@patch("ansible_collections.community.general.plugins.callback.elastic.socket")
|
||||
def setUp(self, mock_socket):
|
||||
if sys.version_info < ELASTIC_MINIMUM_PYTHON_VERSION:
|
||||
self.skipTest(f"Python {'.'.join(map(str, ELASTIC_MINIMUM_PYTHON_VERSION))}+ is needed for Elastic")
|
||||
mock_socket.gethostname.return_value = "my-host"
|
||||
mock_socket.gethostbyname.return_value = "1.2.3.4"
|
||||
self.elastic = ElasticSource(display=None)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from collections import OrderedDict
|
||||
from unittest.mock import patch, MagicMock, Mock
|
||||
|
|
@ -13,18 +12,10 @@ from ansible.playbook.task import Task
|
|||
from ansible.executor.task_result import TaskResult
|
||||
from ansible_collections.community.general.plugins.callback.opentelemetry import OpenTelemetrySource, TaskData
|
||||
|
||||
OPENTELEMETRY_MINIMUM_PYTHON_VERSION = (3, 7)
|
||||
|
||||
|
||||
class TestOpentelemetry(unittest.TestCase):
|
||||
@patch("ansible_collections.community.general.plugins.callback.opentelemetry.socket")
|
||||
def setUp(self, mock_socket):
|
||||
# TODO: this python version validation won't be needed as long as the _time_ns call is mocked.
|
||||
if sys.version_info < OPENTELEMETRY_MINIMUM_PYTHON_VERSION:
|
||||
self.skipTest(
|
||||
f"Python {'.'.join(map(str, OPENTELEMETRY_MINIMUM_PYTHON_VERSION))}+ is needed for OpenTelemetry"
|
||||
)
|
||||
|
||||
mock_socket.gethostname.return_value = "my-host"
|
||||
mock_socket.gethostbyname.return_value = "1.2.3.4"
|
||||
self.opentelemetry = OpenTelemetrySource(display=None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue