Skip to content

Commit

Permalink
Updates to snapshot generation script (#742)
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb authored Aug 29, 2023
1 parent d1decb9 commit 42d5d03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion metricflow/test/fixtures/sql_client_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def __configure_test_env_from_url(url: str, password: str, schema: str) -> sqlal

def __configure_bigquery_env_from_credential_string(password: str, schema: str) -> None:
credential_string = password.replace("'", "")
credentials = json.loads(credential_string)
# `strict=False` required to work with BQ password characters.
credentials = json.loads(credential_string, strict=False)

assert isinstance(credentials, dict), "JSON credential string did not parse to dict type!"

Expand Down
5 changes: 4 additions & 1 deletion metricflow/test/generate_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,12 @@ def run_tests(test_configuration: MetricFlowTestConfiguration, test_file_paths:
engine_name = test_configuration.engine.value.lower()
os.environ["MF_TEST_ADAPTER_TYPE"] = engine_name
hatch_env = f"{engine_name}-env"
use_persistent_source_schema = test_configuration.engine != SqlEngine.POSTGRES
run_command(
f"hatch -v run {hatch_env}:pytest -x -vv -n 4 "
f"--overwrite-snapshots --use-persistent-source-schema {combined_paths}"
f"--overwrite-snapshots"
f"{' --use-persistent-source-schema' if use_persistent_source_schema else ''}"
f" {combined_paths}"
)
else:
assert_values_exhausted(test_configuration.engine)
Expand Down

0 comments on commit 42d5d03

Please sign in to comment.