Skip to content

Commit 7aaba2d

Browse files
[Internal] Better isolate ML serving auth unit tests (#803)
## Changes This PR better isolates ML serving auth tests by explicitly ignoring the config file if any. This solves an issue for users running the tests in an environment (e.g. their local environment) that already has a `.databrickscfg` file. Note: the solution is a little hacky and we should think about a better way to communicate that the config file should be ignored. ## Tests Verified that the unit tests succeed in an environment that has a `.databrickscfg`. - [x] `make test` run locally - [x] `make fmt` applied - [x] relevant integration tests applied
1 parent a1bfd69 commit 7aaba2d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/test_model_serving_auth.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ def test_model_serving_auth(env_values, del_env_values, oauth_file_name, monkeyp
5656
])
5757
@raises(default_auth_base_error_message)
5858
def test_model_serving_auth_errors(env_values, oauth_file_name, monkeypatch):
59+
# Guarantee that the tests defaults to env variables rather than config file.
60+
#
61+
# TODO: this is hacky and we should find a better way to tell the config
62+
# that it should not read from the config file.
63+
monkeypatch.setenv('DATABRICKS_CONFIG_FILE', 'x')
64+
5965
for (env_name, env_value) in env_values:
6066
monkeypatch.setenv(env_name, env_value)
6167
monkeypatch.setattr(

0 commit comments

Comments
 (0)