Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quick] use correct context type annotations in tests #16507

Merged
merged 4 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
Map,
Noneable,
Nothing,
OpExecutionContext,
Out,
Output,
PythonObjectDagsterType,
Expand Down Expand Up @@ -733,7 +734,7 @@ def spawn() -> int:
@op(
required_resource_keys={"retry_count"},
)
def fail(context: AssetExecutionContext, depth: int) -> int:
def fail(context: OpExecutionContext, depth: int) -> int:
if context.resources.retry_count <= depth:
raise Exception("fail")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import dagster._check as check
import pytest
from dagster import (
AssetExecutionContext,
AssetKey,
DagsterExecutionStepNotFoundError,
DagsterInvalidConfigError,
DagsterInvariantViolationError,
Field,
OpExecutionContext,
Out,
Output,
ReexecutionOptions,
Expand Down Expand Up @@ -377,7 +377,7 @@ def echo(x):


@op
def fail_once(context: AssetExecutionContext, x):
def fail_once(context: OpExecutionContext, x):
key = context.op_handle.name
if context.instance.run_storage.get_cursor_values({key}).get(key):
return x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
materialize,
op,
)
from dagster._core.execution.context.compute import OpExecutionContext
from dagster._core.execution.context.compute import AssetExecutionContext
from dagster_dbt import dbt_assets
from dagster_dbt.asset_utils import build_dbt_asset_selection
from dagster_dbt.core.resources_v2 import (
Expand Down Expand Up @@ -209,7 +209,7 @@ def test_dbt_with_partial_parse() -> None:

def test_dbt_cli_debug_execution() -> None:
@dbt_assets(manifest=manifest)
def my_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
yield from dbt.cli(["--debug", "run"], context=context).stream()

result = materialize(
Expand All @@ -230,7 +230,7 @@ def test_dbt_cli_subsetted_execution() -> None:
)

@dbt_assets(manifest=manifest, select=dbt_select)
def my_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
dbt_cli_invocation = dbt.cli(["run"], context=context)

assert dbt_cli_invocation.process.args == ["dbt", "run", "--select", dbt_select]
Expand All @@ -253,7 +253,7 @@ def test_dbt_cli_asset_selection() -> None:
]

@dbt_assets(manifest=manifest)
def my_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
dbt_cli_invocation = dbt.cli(["run"], context=context)

dbt_cli_args: List[str] = list(dbt_cli_invocation.process.args) # type: ignore
Expand Down Expand Up @@ -283,7 +283,7 @@ def my_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
@pytest.mark.parametrize("exclude", [None, "fqn:dagster_dbt_test_project.subdir.least_caloric"])
def test_dbt_cli_default_selection(exclude: Optional[str]) -> None:
@dbt_assets(manifest=manifest, exclude=exclude)
def my_dbt_assets(context: OpExecutionContext, dbt: DbtCliResource):
def my_dbt_assets(context: AssetExecutionContext, dbt: DbtCliResource):
dbt_cli_invocation = dbt.cli(["run"], context=context)

expected_args = ["dbt", "run", "--select", "fqn:*"]
Expand Down