Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade azure, openstack sdks and moto to latest #323

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cloudbridge/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ def discover_providers(self):
"""
for _, modname, _ in pkgutil.iter_modules(providers.__path__):
log.debug("Importing provider: %s", modname)
try:
self._import_provider(modname)
except Exception as e:
log.debug("Could not import provider: %s", e)
self._import_provider(modname)

def _import_provider(self, module_name):
"""
Expand Down
16 changes: 4 additions & 12 deletions cloudbridge/providers/mock/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
boto being hijacked, which will cause AWS to malfunction.
See notes below.
"""
from moto import mock_ec2
from moto import mock_route53
from moto import mock_s3
from moto import mock_aws

from ..aws import AWSCloudProvider
from ...interfaces.provider import TestMockHelperMixin
Expand All @@ -32,17 +30,11 @@ def setUpMock(self):
"""
Let Moto take over all socket communications
"""
self.ec2mock = mock_ec2()
self.ec2mock.start()
self.s3mock = mock_s3()
self.s3mock.start()
self.route53mock = mock_route53()
self.route53mock.start()
self.mock_aws = mock_aws()
self.mock_aws.start()

def tearDownMock(self):
"""
Stop Moto intercepting all socket communications
"""
self.s3mock.stop()
self.ec2mock.stop()
self.route53mock.stop()
self.mock_aws.stop()
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
'azure-identity<2.0.0',
'azure-common<2.0.0',
'azure-mgmt-devtestlabs<10.0.0',
'azure-mgmt-resource<22.0.0',
'azure-mgmt-compute>=27.2.0,<28.0.0',
'azure-mgmt-network<22.0.0',
'azure-mgmt-storage<21.0.0',
'azure-mgmt-resource<24.0.0',
'azure-mgmt-compute>=27.2.0,<31.0.0',
'azure-mgmt-network<26.0.0',
'azure-mgmt-storage<22.0.0',
'azure-storage-blob<13.0.0',
'azure-cosmosdb-table<2.0.0',
'pysftp<1.0.0'
Expand All @@ -47,18 +47,18 @@
'google-api-python-client>=2.0,<3.0.0'
]
REQS_OPENSTACK = [
'openstacksdk>=0.12.0,<1.0.0',
'openstacksdk>=0.12.0,<4.0.0',
'python-novaclient>=7.0.0,<19.0',
'python-swiftclient>=3.2.0,<5.0',
'python-neutronclient>=6.0.0,<9.0',
'python-neutronclient>=6.0.0,<12.0',
'python-keystoneclient>=3.13.0,<6.0'
]
REQS_FULL = REQS_AWS + REQS_GCP + REQS_OPENSTACK + REQS_AZURE
# httpretty is required with/for moto 1.0.0 or AWS tests fail
REQS_DEV = ([
'tox>=4.0.0',
'pytest',
'moto>=3.1.18',
'moto[ec2,s3]>=5.0.0',
'sphinx>=1.3.1',
'pydevd',
'flake8>=3.3.0',
Expand Down
3 changes: 2 additions & 1 deletion tests/test_cloud_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ def test_get_provider_class_invalid(self):
self.assertIsNone(CloudProviderFactory().get_provider_class("aws1"))

def test_find_provider_include_mocks(self):
providers = CloudProviderFactory().get_all_provider_classes()
self.assertTrue(
any(cls for cls
in CloudProviderFactory().get_all_provider_classes()
in providers
if issubclass(cls, TestMockHelperMixin)),
"expected to find at least one mock provider")

Expand Down
Loading