Skip to content

Commit 4597c36

Browse files
authored
[Internal] Fix get_workspace_client test to match Go SDK behavior (#738)
## Changes The current get_workspace_client test fails because the SP used by the test does not have access to the first workspace listed. In the [Go](https://github.com/databricks/databricks-sdk-go/blob/main/internal/account_client_test.go#L12) & [Java](https://github.com/databricks/databricks-sdk-java/blob/1b90e2318f8221ac0a6e4b56c9b0e4c286e38c9f/databricks-sdk-java/src/test/java/com/databricks/sdk/integration/AccountClientIT.java#L17) SDKs, the corresponding test respects the `TEST_WORKSPACE_ID` environment variable to know which workspace to attempt to login to. This PR changes the test to use that environment variable as well. ## Tests <!-- How is this tested? Please see the checklist below and also describe any other relevant tests --> - [ ] `make test` run locally - [ ] `make fmt` applied - [ ] relevant integration tests applied
1 parent dd07079 commit 4597c36

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tests/integration/test_client.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import pytest
2-
3-
41
def test_get_workspace_client(ucacct, env_or_skip):
52
# Need to switch to ucacct
63
workspace_id = env_or_skip("TEST_WORKSPACE_ID")
@@ -14,10 +11,9 @@ def test_get_workspace_id(ucws, env_or_skip):
1411
assert ucws.get_workspace_id() == ws_id
1512

1613

17-
def test_creating_ws_client_from_ac_client_does_not_override_config(a):
18-
wss = list(a.workspaces.list())
19-
if len(wss) == 0:
20-
pytest.skip("no workspaces")
21-
w = a.get_workspace_client(wss[0])
14+
def test_creating_ws_client_from_ac_client_does_not_override_config(ucacct, env_or_skip):
15+
ws_id = env_or_skip('TEST_WORKSPACE_ID')
16+
ws = ucacct.workspaces.get(ws_id)
17+
w = ucacct.get_workspace_client(ws)
2218
me = w.current_user.me()
2319
assert me.user_name is not None

0 commit comments

Comments
 (0)