Skip to content

Commit

Permalink
[dagster-tableau] Fix merge conflict related to repository_def_from_p…
Browse files Browse the repository at this point in the history
…ointer (dagster-io#25454)

## Summary 

Move to new apis introduced in dagster-io#25436
  • Loading branch information
benpankow authored and Grzyblon committed Oct 26, 2024
1 parent 9cc4e92 commit bd2efed
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from unittest.mock import MagicMock

from dagster._core.code_pointer import CodePointer
from dagster._core.definitions.definitions_load_context import DefinitionsLoadType
from dagster._core.definitions.reconstruct import (
ReconstructableJob,
ReconstructableRepository,
repository_def_from_pointer,
initialize_repository_def_from_pointer,
reconstruct_repository_def_from_pointer,
)
from dagster._core.events import DagsterEventType
from dagster._core.execution.api import create_execution_plan, execute_plan
Expand All @@ -31,7 +31,14 @@ def test_using_cached_asset_data_with_refresh_request(
assert get_job.call_count == 0
assert cancel_job.call_count == 0

from dagster_tableau_tests.definitions import defs
pointer = CodePointer.from_python_file(
str(Path(__file__).parent / "definitions.py"),
"defs",
None,
)
init_repository_def = initialize_repository_def_from_pointer(
pointer,
)

# 3 calls to creates the defs
assert sign_in.call_count == 1
Expand All @@ -43,19 +50,13 @@ def test_using_cached_asset_data_with_refresh_request(
assert cancel_job.call_count == 0

# 1 Tableau external assets, 2 Tableau materializable asset and 1 Dagster materializable asset
assert len(defs.get_repository_def().assets_defs_by_key) == 1 + 2 + 1
assert len(init_repository_def.assets_defs_by_key) == 1 + 2 + 1

repository_load_data = defs.get_repository_def().repository_load_data
repository_load_data = init_repository_def.repository_load_data

# We use a separate file here just to ensure we get a fresh load
pointer = CodePointer.from_python_file(
str(Path(__file__).parent / "definitions.py"),
"defs",
None,
)
recon_repository_def = repository_def_from_pointer(
recon_repository_def = reconstruct_repository_def_from_pointer(
pointer,
DefinitionsLoadType.RECONSTRUCTION,
repository_load_data,
)
assert len(recon_repository_def.assets_defs_by_key) == 1 + 2 + 1
Expand Down

0 comments on commit bd2efed

Please sign in to comment.