mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-07-29 11:55:04 +00:00
Avoid Python 2 compat (conditional) imports. (#1167)
This commit is contained in:
@@ -22,6 +22,7 @@ import time
|
||||
import unittest
|
||||
from http.server import BaseHTTPRequestHandler
|
||||
from socketserver import ThreadingTCPServer
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
@@ -41,12 +42,6 @@ from ansible_collections.community.docker.tests.unit.plugins.module_utils._api.c
|
||||
from .. import fake_api
|
||||
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
|
||||
DEFAULT_TIMEOUT_SECONDS = constants.DEFAULT_TIMEOUT_SECONDS
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import random
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -28,12 +29,6 @@ from ansible_collections.community.docker.plugins.module_utils._api.credentials.
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
|
||||
class RegressionTest(unittest.TestCase):
|
||||
def test_803_urlsafe_encode(self):
|
||||
auth_data = {"username": "root", "password": "GR?XGR?XGR?XGR?X"}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from ssl import OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_TLSv1
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -24,13 +25,6 @@ except ImportError:
|
||||
else:
|
||||
HAS_MATCH_HOSTNAME = True # pylint: disable=invalid-name
|
||||
|
||||
try:
|
||||
from ssl import OP_NO_SSLv2, OP_NO_SSLv3, OP_NO_TLSv1
|
||||
except ImportError:
|
||||
OP_NO_SSLv2 = 0x1000000
|
||||
OP_NO_SSLv3 = 0x2000000
|
||||
OP_NO_TLSv1 = 0x4000000
|
||||
|
||||
|
||||
class SSLAdapterTest(unittest.TestCase):
|
||||
def test_only_uses_tls(self):
|
||||
|
||||
@@ -14,18 +14,13 @@ import shutil
|
||||
import tempfile
|
||||
import typing as t
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
from pytest import fixture, mark
|
||||
|
||||
from ansible_collections.community.docker.plugins.module_utils._api.utils import config
|
||||
|
||||
|
||||
try:
|
||||
from unittest import mock
|
||||
except ImportError:
|
||||
import mock
|
||||
|
||||
|
||||
class FindConfigFileTest(unittest.TestCase):
|
||||
mkdir: t.Callable[[str], os.PathLike[str]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user