Skip to content

Commit

Permalink
fix: set extra model paths (#22)
Browse files Browse the repository at this point in the history
Signed-off-by: Charles Moore <[email protected]>
  • Loading branch information
moorec-aws authored Oct 5, 2023
1 parent cbba4db commit 2d20725
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/deadline_test_fixtures/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def deadline_client(
if endpoint_url:
LOG.info(f"Using Amazon Deadline Cloud endpoint: {endpoint_url}")

return DeadlineClient(boto3.client("deadline", endpoint_url=endpoint_url))
session = boto3.Session()
session._loader.search_paths.extend([install_service_model])

return DeadlineClient(session.client("deadline", endpoint_url=endpoint_url))


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -160,11 +163,11 @@ def service_model() -> Generator[ServiceModel, None, None]:


@pytest.fixture(scope="session")
def install_service_model(service_model: ServiceModel) -> Generator[None, None, None]:
def install_service_model(service_model: ServiceModel) -> Generator[str, None, None]:
LOG.info("Installing service model and configuring boto to use it for API calls")
with service_model.install() as model_path:
LOG.info(f"Installed service model to {model_path}")
yield
yield model_path


@pytest.fixture(scope="session")
Expand Down
2 changes: 1 addition & 1 deletion src/deadline_test_fixtures/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def install(self) -> Generator[str, None, None]:
json_path.parent.mkdir(parents=True)
json_path.write_text(src_file.read_text())
os.environ["AWS_DATA_PATH"] = tmpdir
yield str(json_path)
yield str(tmpdir)
finally:
if old_aws_data_path:
os.environ["AWS_DATA_PATH"] = old_aws_data_path
Expand Down

0 comments on commit 2d20725

Please sign in to comment.