From 46788b4642cab250847409ac3fb9bd736b765650 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 12 Feb 2024 15:49:13 +0900 Subject: [PATCH] Run black format ... to resolve the lint failure in CI. --- podman/api/typing_extensions.py | 6 ++-- podman/tests/unit/test_build.py | 3 +- podman/tests/unit/test_config.py | 6 ++-- podman/tests/unit/test_container.py | 36 +++++++-------------- podman/tests/unit/test_containersmanager.py | 3 +- podman/tests/unit/test_imagesmanager.py | 12 +++---- podman/tests/unit/test_pod.py | 3 +- podman/tests/unit/test_podmanclient.py | 6 ++-- podman/tests/unit/test_podsmanager.py | 6 ++-- 9 files changed, 33 insertions(+), 48 deletions(-) diff --git a/podman/api/typing_extensions.py b/podman/api/typing_extensions.py index 125a22ee..531a7ba5 100644 --- a/podman/api/typing_extensions.py +++ b/podman/api/typing_extensions.py @@ -952,7 +952,8 @@ class AsyncContextManager( __all__.append('AsyncContextManager') elif sys.version_info[:2] >= (3, 5): - exec(""" + exec( + """ class AsyncContextManager(typing.Generic[T_co]): __slots__ = () @@ -970,7 +971,8 @@ def __subclasshook__(cls, C): return NotImplemented __all__.append('AsyncContextManager') -""") +""" + ) if hasattr(typing, 'DefaultDict'): DefaultDict = typing.DefaultDict diff --git a/podman/tests/unit/test_build.py b/podman/tests/unit/test_build.py index ece0a7b6..a12187ea 100644 --- a/podman/tests/unit/test_build.py +++ b/podman/tests/unit/test_build.py @@ -61,8 +61,7 @@ def test_build(self, mock_prepare_containerfile, mock_create_tar): with requests_mock.Mocker() as mock: mock.post( - tests.LIBPOD_URL - + "/build" + tests.LIBPOD_URL + "/build" "?t=latest" "&buildargs=%7B%22BUILD_DATE%22%3A+%22January+1%2C+1970%22%7D" "&cpuperiod=10" diff --git a/podman/tests/unit/test_config.py b/podman/tests/unit/test_config.py index 402fa64c..7ecb475a 100644 --- a/podman/tests/unit/test_config.py +++ b/podman/tests/unit/test_config.py @@ -8,7 +8,8 @@ class PodmanConfigTestCase(unittest.TestCase): - opener = mock.mock_open(read_data=""" + opener = mock.mock_open( + read_data=""" [containers] log_size_max = -1 pids_limit = 2048 @@ -27,7 +28,8 @@ class PodmanConfigTestCase(unittest.TestCase): identity = "/home/qe/.ssh/id_rsa" [network] -""") +""" + ) def setUp(self) -> None: super().setUp() diff --git a/podman/tests/unit/test_container.py b/podman/tests/unit/test_container.py index 3fe5fb98..4ed04cc0 100644 --- a/podman/tests/unit/test_container.py +++ b/podman/tests/unit/test_container.py @@ -38,8 +38,7 @@ def tearDown(self) -> None: @requests_mock.Mocker() def test_remove(self, mock): adapter = mock.delete( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd?v=True&force=True", status_code=204, ) @@ -71,8 +70,7 @@ def test_rename_type_error(self, mock): @requests_mock.Mocker() def test_restart(self, mock): adapter = mock.post( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/restart?timeout=10", status_code=204, ) @@ -83,8 +81,7 @@ def test_restart(self, mock): @requests_mock.Mocker() def test_start_dkeys(self, mock): adapter = mock.post( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/start" "?detachKeys=%5Ef%5Eu", status_code=204, @@ -120,8 +117,7 @@ def test_stats(self, mock): buffer.write("\n") adapter = mock.get( - tests.LIBPOD_URL - + "/containers/stats" + tests.LIBPOD_URL + "/containers/stats" "?containers=87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd" "&stream=True", text=buffer.getvalue(), @@ -143,8 +139,7 @@ def test_stats(self, mock): @requests_mock.Mocker() def test_stop(self, mock): adapter = mock.post( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/stop" "?all=True&timeout=10.0", status_code=204, @@ -173,8 +168,7 @@ def test_stop_304(self, mock): @requests_mock.Mocker() def test_unpause(self, mock): adapter = mock.post( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/unpause", status_code=204, ) @@ -225,8 +219,7 @@ def test_diff(self, mock): {"Path": "deleted", "Kind": 2}, ] adapter = mock.get( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/changes", json=payload, ) @@ -238,8 +231,7 @@ def test_diff(self, mock): @requests_mock.Mocker() def test_diff_404(self, mock): adapter = mock.get( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/changes", json={ "cause": "Container not found.", @@ -284,8 +276,7 @@ def test_get_archive(self, mock): encoded_value = base64.urlsafe_b64encode(json.dumps(header_value).encode("utf8")) adapter = mock.get( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/archive" "?path=/etc/motd", body=body, @@ -306,8 +297,7 @@ def test_get_archive(self, mock): @requests_mock.Mocker() def test_commit(self, mock): post_adapter = mock.post( - tests.LIBPOD_URL - + "/commit" + tests.LIBPOD_URL + "/commit" "?author=redhat&changes=ADD+%2fetc%2fmod&comment=This+is+a+unittest" "&container=87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd&format=docker" "&pause=True&repo=quay.local&tag=unittest", @@ -340,8 +330,7 @@ def test_commit(self, mock): @requests_mock.Mocker() def test_put_archive(self, mock): adapter = mock.put( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/archive" "?path=%2fetc%2fmotd", status_code=200, @@ -357,8 +346,7 @@ def test_put_archive(self, mock): @requests_mock.Mocker() def test_put_archive_404(self, mock): adapter = mock.put( - tests.LIBPOD_URL - + "/containers/" + tests.LIBPOD_URL + "/containers/" "87e1325c82424e49a00abdd4de08009eb76c7de8d228426a9b8af9318ced5ecd/archive" "?path=deadbeef", status_code=404, diff --git a/podman/tests/unit/test_containersmanager.py b/podman/tests/unit/test_containersmanager.py index 1f8b4b13..036809f8 100644 --- a/podman/tests/unit/test_containersmanager.py +++ b/podman/tests/unit/test_containersmanager.py @@ -112,8 +112,7 @@ def test_list(self, mock): @requests_mock.Mocker() def test_list_filtered(self, mock): mock.get( - tests.LIBPOD_URL - + "/containers/json?" + tests.LIBPOD_URL + "/containers/json?" "all=True" "&filters=%7B" "%22before%22%3A" diff --git a/podman/tests/unit/test_imagesmanager.py b/podman/tests/unit/test_imagesmanager.py index e3828ee7..1403af27 100644 --- a/podman/tests/unit/test_imagesmanager.py +++ b/podman/tests/unit/test_imagesmanager.py @@ -457,8 +457,7 @@ def test_pull(self, mock): }, ) mock.get( - tests.LIBPOD_URL - + "/images" + tests.LIBPOD_URL + "/images" "/sha256%3A326dd9d7add24646a325e8eaa82125294027db2332e49c5828d96312c5d773ab/json", json=FIRST_IMAGE, ) @@ -479,8 +478,7 @@ def test_pull_enhanced(self, mock): }, ) mock.get( - tests.LIBPOD_URL - + "/images" + tests.LIBPOD_URL + "/images" "/sha256%3A326dd9d7add24646a325e8eaa82125294027db2332e49c5828d96312c5d773ab/json", json=FIRST_IMAGE, ) @@ -501,8 +499,7 @@ def test_pull_platform(self, mock): }, ) mock.get( - tests.LIBPOD_URL - + "/images" + tests.LIBPOD_URL + "/images" "/sha256%3A326dd9d7add24646a325e8eaa82125294027db2332e49c5828d96312c5d773ab/json", json=FIRST_IMAGE, ) @@ -527,8 +524,7 @@ def test_pull_2x(self, mock): }, ) mock.get( - tests.LIBPOD_URL - + "/images" + tests.LIBPOD_URL + "/images" "/sha256%3A326dd9d7add24646a325e8eaa82125294027db2332e49c5828d96312c5d773ab/json", json=FIRST_IMAGE, ) diff --git a/podman/tests/unit/test_pod.py b/podman/tests/unit/test_pod.py index fe6d1d09..7fb5dd13 100644 --- a/podman/tests/unit/test_pod.py +++ b/podman/tests/unit/test_pod.py @@ -180,8 +180,7 @@ def test_top(self, mock): "Titles": ["UID", "PID", "PPID", "C", "STIME", "TTY", "TIME CMD"], } adapter = mock.get( - tests.LIBPOD_URL - + "/pods" + tests.LIBPOD_URL + "/pods" "/c8b9f5b17dc1406194010c752fc6dcb330192032e27648db9b14060447ecf3b8/top" "?ps_args=aux&stream=False", json=body, diff --git a/podman/tests/unit/test_podmanclient.py b/podman/tests/unit/test_podmanclient.py index 5386ef0a..66a739cf 100644 --- a/podman/tests/unit/test_podmanclient.py +++ b/podman/tests/unit/test_podmanclient.py @@ -13,7 +13,8 @@ class PodmanClientTestCase(unittest.TestCase): """Test the PodmanClient() object.""" - opener = mock.mock_open(read_data=""" + opener = mock.mock_open( + read_data=""" [containers] log_size_max = -1 pids_limit = 2048 @@ -32,7 +33,8 @@ class PodmanClientTestCase(unittest.TestCase): identity = "/home/qe/.ssh/id_rsa" [network] -""") +""" + ) def setUp(self) -> None: super().setUp() diff --git a/podman/tests/unit/test_podsmanager.py b/podman/tests/unit/test_podsmanager.py index 36b11a7c..73886cb3 100644 --- a/podman/tests/unit/test_podsmanager.py +++ b/podman/tests/unit/test_podsmanager.py @@ -149,8 +149,7 @@ def test_stats(self, mock): "Titles": ["UID", "PID", "PPID", "C", "STIME", "TTY", "TIME CMD"], } mock.get( - tests.LIBPOD_URL - + "/pods/stats" + tests.LIBPOD_URL + "/pods/stats" "?namesOrIDs=c8b9f5b17dc1406194010c752fc6dcb330192032e27648db9b14060447ecf3b8", json=body, ) @@ -180,8 +179,7 @@ def test_stats_without_decode(self, mock): "Titles": ["UID", "PID", "PPID", "C", "STIME", "TTY", "TIME CMD"], } mock.get( - tests.LIBPOD_URL - + "/pods/stats" + tests.LIBPOD_URL + "/pods/stats" "?namesOrIDs=c8b9f5b17dc1406194010c752fc6dcb330192032e27648db9b14060447ecf3b8", json=body, )