Skip to content

Commit

Permalink
Drop singleton pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Sep 4, 2024
1 parent 4ad8a3a commit a9f25a5
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 94 deletions.
4 changes: 1 addition & 3 deletions cloudview/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
from libcloud.compute.types import NodeState, LibcloudError
from requests.exceptions import RequestException

from cloudview.singleton import Singleton2

STATES = [str(getattr(NodeState, _)) for _ in dir(NodeState) if _.isupper()]


Expand All @@ -31,7 +29,7 @@ class Instance: # pylint: disable=too-many-instance-attributes
extra: dict


class CSP(metaclass=Singleton2):
class CSP:
"""
Cloud Service Provider class
"""
Expand Down
39 changes: 0 additions & 39 deletions cloudview/singleton.py

This file was deleted.

5 changes: 0 additions & 5 deletions tests/test_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ def test_get_creds_missing_env_vars():
assert "subscription_id" not in creds


@pytest.fixture(autouse=True)
def reset_singleton(monkeypatch):
monkeypatch.setattr(Azure, "_singleton_instances", {})


@pytest.fixture
def valid_creds():
return {
Expand Down
5 changes: 0 additions & 5 deletions tests/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ def valid_creds():
return {"key": "your_access_key", "secret": "your_secret_key"}


@pytest.fixture(autouse=True)
def reset_singleton(monkeypatch):
monkeypatch.setattr(EC2, "_singleton_instances", {})


def test_list_instances_in_region(
mock_ec2_driver, mock_ec2_instance, mocker, valid_creds
):
Expand Down
6 changes: 0 additions & 6 deletions tests/test_gce.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ def test_get_creds_with_invalid_creds_file_and_env_var(
assert creds is None


# Fixture to reset the singleton instance before each test
@pytest.fixture(autouse=True)
def reset_singleton(monkeypatch):
monkeypatch.setattr(GCE, "_singleton_instances", {})


@pytest.fixture
def valid_creds():
return {
Expand Down
6 changes: 0 additions & 6 deletions tests/test_openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ def test_get_creds_with_missing_auth_url(mock_openstack_env, monkeypatch):
assert not creds


# Fixture to reset the singleton instance before each test
@pytest.fixture(autouse=True)
def reset_singleton(monkeypatch):
monkeypatch.setattr(Openstack, "_singleton_instances", {})


@pytest.fixture
def valid_creds():
return {
Expand Down
30 changes: 0 additions & 30 deletions tests/test_singleton.py

This file was deleted.

0 comments on commit a9f25a5

Please sign in to comment.