forked from pool/python-hcloud
* Add suport for primary IPs - Add patch remove-mock.patch: * Use unittest.mock. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-hcloud?expand=0&rev=5
238 lines
8.3 KiB
Diff
238 lines
8.3 KiB
Diff
From 46a8eb17f8c6cd81635708d80aaa3a8357c5fb03 Mon Sep 17 00:00:00 2001
|
|
From: Steve Kowalik <steven@wedontsleep.org>
|
|
Date: Tue, 2 Aug 2022 14:53:06 +1000
|
|
Subject: [PATCH] Remove use of external mock module
|
|
|
|
Python since 3.4 has included mock in the standard library, under the
|
|
unittest module. Since the lowest version supported is greater than
|
|
that, we can switch to using it and drop one external requirement.
|
|
---
|
|
requirements/test.txt | 1 -
|
|
tests/unit/actions/test_client.py | 2 +-
|
|
tests/unit/certificates/test_client.py | 2 +-
|
|
tests/unit/conftest.py | 2 +-
|
|
tests/unit/core/test_client.py | 2 +-
|
|
tests/unit/datacenters/test_client.py | 2 +-
|
|
tests/unit/firewalls/test_client.py | 2 +-
|
|
tests/unit/floating_ips/test_client.py | 2 +-
|
|
tests/unit/images/test_client.py | 2 +-
|
|
tests/unit/isos/test_client.py | 2 +-
|
|
tests/unit/load_balancer_types/test_client.py | 2 +-
|
|
tests/unit/load_balancers/test_client.py | 2 +-
|
|
tests/unit/locations/test_client.py | 2 +-
|
|
tests/unit/networks/test_client.py | 2 +-
|
|
tests/unit/placement_groups/test_client.py | 2 +-
|
|
tests/unit/primary_ips/test_client.py | 2 +-
|
|
tests/unit/server_types/test_client.py | 2 +-
|
|
tests/unit/servers/test_client.py | 2 +-
|
|
tests/unit/ssh_keys/test_client.py | 2 +-
|
|
tests/unit/volumes/test_client.py | 2 +-
|
|
20 files changed, 19 insertions(+), 20 deletions(-)
|
|
|
|
diff --git a/tests/unit/actions/test_client.py b/tests/unit/actions/test_client.py
|
|
index d16ec4a..8ee7fe6 100644
|
|
--- a/tests/unit/actions/test_client.py
|
|
+++ b/tests/unit/actions/test_client.py
|
|
@@ -1,4 +1,4 @@
|
|
-import mock
|
|
+from unittest import mock
|
|
import pytest
|
|
|
|
from hcloud.actions.client import ActionsClient, BoundAction
|
|
diff --git a/tests/unit/certificates/test_client.py b/tests/unit/certificates/test_client.py
|
|
index b2acd4e..3090ff2 100644
|
|
--- a/tests/unit/certificates/test_client.py
|
|
+++ b/tests/unit/certificates/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.actions.client import BoundAction
|
|
from hcloud.certificates.client import CertificatesClient, BoundCertificate
|
|
diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py
|
|
index 17c9d62..f40734d 100644
|
|
--- a/tests/unit/conftest.py
|
|
+++ b/tests/unit/conftest.py
|
|
@@ -1,4 +1,4 @@
|
|
-import mock
|
|
+from unittest import mock
|
|
import pytest
|
|
from hcloud import Client
|
|
|
|
diff --git a/tests/unit/core/test_client.py b/tests/unit/core/test_client.py
|
|
index feabf82..7c5aa36 100644
|
|
--- a/tests/unit/core/test_client.py
|
|
+++ b/tests/unit/core/test_client.py
|
|
@@ -1,4 +1,4 @@
|
|
-import mock
|
|
+from unittest import mock
|
|
import pytest
|
|
|
|
from hcloud.core.client import BoundModelBase, ClientEntityBase, GetEntityByNameMixin
|
|
diff --git a/tests/unit/datacenters/test_client.py b/tests/unit/datacenters/test_client.py
|
|
index 3e24e92..a34fe8a 100644
|
|
--- a/tests/unit/datacenters/test_client.py
|
|
+++ b/tests/unit/datacenters/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest # noqa: F401
|
|
-import mock # noqa: F401
|
|
+from unittest import mock # noqa: F401
|
|
|
|
from hcloud.datacenters.client import DatacentersClient, BoundDatacenter
|
|
from hcloud.datacenters.domain import DatacenterServerTypes
|
|
diff --git a/tests/unit/firewalls/test_client.py b/tests/unit/firewalls/test_client.py
|
|
index ab564ea..95311c2 100644
|
|
--- a/tests/unit/firewalls/test_client.py
|
|
+++ b/tests/unit/firewalls/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.firewalls.client import FirewallsClient, BoundFirewall
|
|
from hcloud.actions.client import BoundAction
|
|
diff --git a/tests/unit/floating_ips/test_client.py b/tests/unit/floating_ips/test_client.py
|
|
index 79ce8df..97fcd28 100644
|
|
--- a/tests/unit/floating_ips/test_client.py
|
|
+++ b/tests/unit/floating_ips/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.actions.client import BoundAction
|
|
from hcloud.servers.client import BoundServer
|
|
diff --git a/tests/unit/images/test_client.py b/tests/unit/images/test_client.py
|
|
index 521ad1f..55ec9ba 100644
|
|
--- a/tests/unit/images/test_client.py
|
|
+++ b/tests/unit/images/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
import datetime
|
|
from dateutil.tz import tzoffset
|
|
|
|
diff --git a/tests/unit/isos/test_client.py b/tests/unit/isos/test_client.py
|
|
index 32a2a51..4bb4d37 100644
|
|
--- a/tests/unit/isos/test_client.py
|
|
+++ b/tests/unit/isos/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
import datetime
|
|
from dateutil.tz import tzoffset
|
|
|
|
diff --git a/tests/unit/load_balancer_types/test_client.py b/tests/unit/load_balancer_types/test_client.py
|
|
index 565ce61..b9686ad 100644
|
|
--- a/tests/unit/load_balancer_types/test_client.py
|
|
+++ b/tests/unit/load_balancer_types/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
|
|
from hcloud.load_balancer_types.client import LoadBalancerTypesClient
|
|
diff --git a/tests/unit/load_balancers/test_client.py b/tests/unit/load_balancers/test_client.py
|
|
index 97a765a..b2c05a5 100644
|
|
--- a/tests/unit/load_balancers/test_client.py
|
|
+++ b/tests/unit/load_balancers/test_client.py
|
|
@@ -1,4 +1,4 @@
|
|
-import mock
|
|
+from unittest import mock
|
|
import pytest
|
|
|
|
from hcloud.load_balancer_types.domain import LoadBalancerType
|
|
diff --git a/tests/unit/locations/test_client.py b/tests/unit/locations/test_client.py
|
|
index 8b4d5ab..217d6ae 100644
|
|
--- a/tests/unit/locations/test_client.py
|
|
+++ b/tests/unit/locations/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest # noqa: F401
|
|
-import mock # noqa: F401
|
|
+from unittest import mock # noqa: F401
|
|
|
|
from hcloud.locations.client import LocationsClient
|
|
|
|
diff --git a/tests/unit/networks/test_client.py b/tests/unit/networks/test_client.py
|
|
index 062d156..81c12dc 100644
|
|
--- a/tests/unit/networks/test_client.py
|
|
+++ b/tests/unit/networks/test_client.py
|
|
@@ -1,6 +1,6 @@
|
|
import pytest
|
|
from dateutil.parser import isoparse
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.actions.client import BoundAction
|
|
from hcloud.networks.client import BoundNetwork, NetworksClient
|
|
diff --git a/tests/unit/placement_groups/test_client.py b/tests/unit/placement_groups/test_client.py
|
|
index 674ce32..aecea55 100644
|
|
--- a/tests/unit/placement_groups/test_client.py
|
|
+++ b/tests/unit/placement_groups/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.placement_groups.client import BoundPlacementGroup, PlacementGroupsClient
|
|
|
|
diff --git a/tests/unit/primary_ips/test_client.py b/tests/unit/primary_ips/test_client.py
|
|
index 1611cc3..2624f92 100644
|
|
--- a/tests/unit/primary_ips/test_client.py
|
|
+++ b/tests/unit/primary_ips/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.primary_ips.client import PrimaryIPsClient, BoundPrimaryIP
|
|
from hcloud.primary_ips.domain import PrimaryIP
|
|
diff --git a/tests/unit/server_types/test_client.py b/tests/unit/server_types/test_client.py
|
|
index a12a3e8..10c07c2 100644
|
|
--- a/tests/unit/server_types/test_client.py
|
|
+++ b/tests/unit/server_types/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
|
|
from hcloud.server_types.client import ServerTypesClient
|
|
diff --git a/tests/unit/servers/test_client.py b/tests/unit/servers/test_client.py
|
|
index b92e9ff..c8bf249 100644
|
|
--- a/tests/unit/servers/test_client.py
|
|
+++ b/tests/unit/servers/test_client.py
|
|
@@ -1,4 +1,4 @@
|
|
-import mock
|
|
+from unittest import mock
|
|
import pytest
|
|
|
|
from hcloud.firewalls.client import BoundFirewall
|
|
diff --git a/tests/unit/ssh_keys/test_client.py b/tests/unit/ssh_keys/test_client.py
|
|
index 6562304..01ab9e0 100644
|
|
--- a/tests/unit/ssh_keys/test_client.py
|
|
+++ b/tests/unit/ssh_keys/test_client.py
|
|
@@ -1,5 +1,5 @@
|
|
import pytest
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.ssh_keys.client import SSHKeysClient, BoundSSHKey
|
|
from hcloud.ssh_keys.domain import SSHKey
|
|
diff --git a/tests/unit/volumes/test_client.py b/tests/unit/volumes/test_client.py
|
|
index a075ad5..7145194 100644
|
|
--- a/tests/unit/volumes/test_client.py
|
|
+++ b/tests/unit/volumes/test_client.py
|
|
@@ -1,6 +1,6 @@
|
|
import pytest
|
|
from dateutil.parser import isoparse
|
|
-import mock
|
|
+from unittest import mock
|
|
|
|
from hcloud.actions.client import BoundAction
|
|
from hcloud.servers.client import BoundServer
|