This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch dependabot/pip/pytest-8.0.2
in repository https://gitbox.apache.org/repos/asf/libcloud.git

commit f4fe2fbfd17f6039940afe08b97a9e7241ee9075
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Tue Apr 16 19:53:32 2024 +0200

    Also clean up / rest DigitalOcean mock http classes as part of tearDown.
---
 libcloud/test/common/test_digitalocean_v2.py  |  5 ++++-
 libcloud/test/compute/test_digitalocean_v2.py | 18 ++++++++++++++++--
 libcloud/test/dns/test_digitalocean.py        |  7 +++++++
 3 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/libcloud/test/common/test_digitalocean_v2.py 
b/libcloud/test/common/test_digitalocean_v2.py
index 0f39e9cee..957f7a66b 100644
--- a/libcloud/test/common/test_digitalocean_v2.py
+++ b/libcloud/test/common/test_digitalocean_v2.py
@@ -22,7 +22,6 @@ from libcloud.common.types import InvalidCredsError
 from libcloud.test.secrets import DIGITALOCEAN_v2_PARAMS
 from libcloud.test.file_fixtures import FileFixtures
 from libcloud.common.digitalocean import DigitalOceanBaseDriver, 
DigitalOcean_v2_BaseDriver
-from libcloud.dns.drivers.digitalocean import DigitalOceanDNSDriver
 
 
 class DigitalOceanTests(LibcloudTestCase):
@@ -32,6 +31,10 @@ class DigitalOceanTests(LibcloudTestCase):
         DigitalOceanCommonMockHttp.type = None
         self.driver = DigitalOceanBaseDriver(*DIGITALOCEAN_v2_PARAMS)
 
+    def tearDown(self):
+        LibcloudConnection.type = None
+        DigitalOceanCommonMockHttp.type = None
+
     def test_authentication(self):
         DigitalOceanCommonMockHttp.type = "UNAUTHORIZED"
         self.assertRaises(InvalidCredsError, self.driver.ex_account_info)
diff --git a/libcloud/test/compute/test_digitalocean_v2.py 
b/libcloud/test/compute/test_digitalocean_v2.py
index 310f2e778..7ff55ce88 100644
--- a/libcloud/test/compute/test_digitalocean_v2.py
+++ b/libcloud/test/compute/test_digitalocean_v2.py
@@ -24,8 +24,15 @@ from libcloud.compute.base import NodeImage
 from libcloud.test.secrets import DIGITALOCEAN_v1_PARAMS, 
DIGITALOCEAN_v2_PARAMS
 from libcloud.utils.iso8601 import UTC
 from libcloud.test.file_fixtures import ComputeFileFixtures
-from libcloud.common.digitalocean import DigitalOcean_v1_Error
-from libcloud.compute.drivers.digitalocean import DigitalOceanNodeDriver
+from libcloud.common.digitalocean import (
+    DigitalOcean_v1_Error,
+    DigitalOceanBaseDriver,
+    DigitalOcean_v2_BaseDriver,
+)
+from libcloud.compute.drivers.digitalocean import (
+    DigitalOceanNodeDriver,
+    DigitalOcean_v2_NodeDriver,
+)
 
 try:
     import simplejson as json
@@ -36,10 +43,17 @@ except ImportError:
 # class DigitalOceanTests(unittest.TestCase, TestCaseMixin):
 class DigitalOcean_v2_Tests(LibcloudTestCase):
     def setUp(self):
+        DigitalOceanBaseDriver.connectionCls.conn_class = 
DigitalOceanComputeMockHttp
+        DigitalOcean_v2_BaseDriver.connectionCls.conn_class = 
DigitalOceanComputeMockHttp
         DigitalOceanNodeDriver.connectionCls.conn_class = 
DigitalOceanComputeMockHttp
+        DigitalOcean_v2_NodeDriver.connectionCls.conn_class = 
DigitalOceanComputeMockHttp
         DigitalOceanComputeMockHttp.type = None
         self.driver = DigitalOceanNodeDriver(*DIGITALOCEAN_v2_PARAMS)
 
+    def tearDown(self):
+        LibcloudConnection.type = None
+        DigitalOceanComputeMockHttp.type = None
+
     def test_v1_Error(self):
         self.assertRaises(
             DigitalOcean_v1_Error,
diff --git a/libcloud/test/dns/test_digitalocean.py 
b/libcloud/test/dns/test_digitalocean.py
index 952c060ac..2b2118b38 100644
--- a/libcloud/test/dns/test_digitalocean.py
+++ b/libcloud/test/dns/test_digitalocean.py
@@ -21,15 +21,22 @@ from libcloud.dns.types import RecordType
 from libcloud.utils.py3 import httplib
 from libcloud.test.secrets import DIGITALOCEAN_v2_PARAMS
 from libcloud.test.file_fixtures import DNSFileFixtures
+from libcloud.common.digitalocean import DigitalOceanBaseDriver, 
DigitalOcean_v2_BaseDriver
 from libcloud.dns.drivers.digitalocean import DigitalOceanDNSDriver
 
 
 class DigitalOceanDNSTests(LibcloudTestCase):
     def setUp(self):
+        DigitalOceanBaseDriver.connectionCls.conn_class = 
DigitalOceanDNSMockHttp
+        DigitalOcean_v2_BaseDriver.connectionCls.conn_class = 
DigitalOceanDNSMockHttp
         DigitalOceanDNSDriver.connectionCls.conn_class = 
DigitalOceanDNSMockHttp
         DigitalOceanDNSMockHttp.type = None
         self.driver = DigitalOceanDNSDriver(*DIGITALOCEAN_v2_PARAMS)
 
+    def tearDown(self):
+        LibcloudConnection.type = None
+        DigitalOceanDNSMockHttp.type = None
+
     def test_list_zones(self):
         zones = self.driver.list_zones()
         self.assertTrue(len(zones) >= 1)

Reply via email to