15
0
forked from pool/python-hcloud

Accepting request 992132 from devel:languages:python

- Update to 1.17.0:
  * Add suport for primary IPs
- Add patch remove-mock.patch:
  * Use unittest.mock.

OBS-URL: https://build.opensuse.org/request/show/992132
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-hcloud?expand=0&rev=3
This commit is contained in:
2022-08-02 20:09:11 +00:00
committed by Git OBS Bridge
5 changed files with 252 additions and 9 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c8b94557d93bcfe437f20a8176693ea4f54358b74986cc19d94ebc23f48e40cc
size 93682

3
hcloud-1.17.0.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f8142e0438be277c6fa1ddee13aecd5da152b48c6dec7fd4970def1b5dc219e2
size 97841

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Aug 2 05:01:14 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.17.0:
* Add suport for primary IPs
- Add patch remove-mock.patch:
* Use unittest.mock.
-------------------------------------------------------------------
Mon Mar 21 13:04:30 UTC 2022 - pgajdos@suse.com

View File

@@ -18,13 +18,14 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-hcloud
Version: 1.16.0
Version: 1.17.0
Release: 0
Summary: Hetzner Cloud Python library
License: MIT
Group: Development/Languages/Python
URL: https://github.com/hetznercloud/hcloud-python
Source: https://files.pythonhosted.org/packages/source/h/hcloud/hcloud-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#hetznercloud/hcloud-python#162
Patch0: remove-mock.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -34,7 +35,6 @@ Requires: python-requests >= 2.20
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module future >= 0.17.1}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module python-dateutil >= 2.7.5}
BuildRequires: %{python_module requests >= 2.20}
@@ -45,7 +45,7 @@ BuildRequires: %{python_module requests >= 2.20}
Official Hetzner Cloud Python library.
%prep
%setup -q -n hcloud-%{version}
%autosetup -p1 -n hcloud-%{version}
%build
%python_build
@@ -55,8 +55,6 @@ Official Hetzner Cloud Python library.
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
# https://github.com/hetznercloud/hcloud-python/issues/151
sed -i 's:import mock:import unittest.mock as mock:' tests/*.py tests/*/*.py
export LANG=en_US.UTF-8
%pytest tests/unit/

237
remove-mock.patch Normal file
View File

@@ -0,0 +1,237 @@
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