Skip to content

Commit fc9ff44

Browse files
author
nazarfil
committed
fix: fixes circular dependencies
1 parent ba436ce commit fc9ff44

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

openhexa/sdk/workspaces/current_workspace.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
PostgreSQLConnection,
2222
S3Connection,
2323
)
24+
from ...cli.openhexa_client import OpenHexaClient
2425

2526

2627
class WorkspaceConfigError(Exception):
@@ -63,8 +64,6 @@ def slug(self) -> str:
6364
@property
6465
def countries(self) -> list[GetCountriesWorkspaceCountries]:
6566
"""The countries of the workspace."""
66-
from openhexa.cli.api import OpenHexaClient
67-
6867
try:
6968
return OpenHexaClient().get_countries(workspace_slug=self.slug).workspace.countries
7069
except KeyError:

tests/test_detect_breaking_changes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import time
22
from unittest import TestCase, mock
33

4-
from openhexa.cli.api import _detect_graphql_breaking_changes, graphql
4+
from openhexa.cli.openhexa_client import _detect_graphql_breaking_changes, graphql
55

66

77
class TestGraphQLFunctions(TestCase):
8-
@mock.patch("openhexa.cli.api._query_graphql")
9-
@mock.patch("openhexa.cli.api.get_library_versions")
8+
@mock.patch("openhexa.cli.openhexa_client._query_graphql")
9+
@mock.patch("openhexa.cli.openhexa_client.get_library_versions")
1010
def test_detect_graphql_breaking_changes_with_mocked_server_schema(
1111
self, mock_get_library_versions, mock_query_graphql
1212
):
@@ -53,11 +53,11 @@ def test_detect_graphql_breaking_changes_with_mocked_server_schema(
5353
)
5454
mock_click_secho.assert_any_call("- Query.testField changed type from Int to String.", fg="yellow")
5555

56-
@mock.patch("openhexa.cli.api._query_graphql")
57-
@mock.patch("openhexa.cli.api._detect_graphql_breaking_changes")
56+
@mock.patch("openhexa.cli.openhexa_client._query_graphql")
57+
@mock.patch("openhexa.cli.openhexa_client._detect_graphql_breaking_changes")
5858
def test_graphql(self, mock_detect_graphql_breaking_changes, mock_query_graphql):
5959
"""Test that the graphql function is caching the breaking change detection for 1 hour."""
60-
with mock.patch("openhexa.cli.api.settings") as mock_settings:
60+
with mock.patch("openhexa.cli.openhexa_client.settings") as mock_settings:
6161
mock_settings.last_breaking_change_check = time.time() - 59 * 60 # Last checked 59 minutes ago
6262
mock_query_graphql.return_value = {"data": "response"}
6363

0 commit comments

Comments
 (0)