Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-db committed Oct 11, 2024
1 parent 90d5fd5 commit b2393d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 1 addition & 10 deletions tests/unit/macros/adapters/test_python_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,12 @@ def test_py_get_writer__specified_file_format(self, config, template):

def test_py_get_writer__specified_location_root(self, config, template, context):
config["location_root"] = "s3://fake_location"
template.globals["adapter"].compute_external_path.return_value = "s3://fake_location/schema"
result = self.run_macro_raw(template, "py_get_writer_options")

expected = '.format("delta")\n.option("path", "s3://fake_location/schema")'
assert result == expected

def test_py_get_writer__specified_location_root_on_incremental(
self, config, template: Template, context
):
config["location_root"] = "s3://fake_location"
context["is_incremental"].return_value = True
result = self.run_macro_raw(template, "py_get_writer_options")

expected = '.format("delta")\n.option("path", "s3://fake_location/schema__dbt_tmp")'
assert result == expected

def test_py_get_writer__partition_by_single_column(self, config, template):
config["partition_by"] = "name"
result = self.run_macro_raw(template, "py_get_writer_options")
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/macros/relations/test_table_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def context(self, template) -> dict:
return template.globals

def render_create_table_as(self, template_bundle, temporary=False, sql="select 1"):
external_path = f"/mnt/root/{template_bundle.relation.identifier}"
template_bundle.template.globals["adapter"].compute_external_path.return_value = (
external_path
)
return self.run_macro(
template_bundle.template,
"databricks__create_table_as",
Expand Down

0 comments on commit b2393d2

Please sign in to comment.