Skip to content

Commit

Permalink
move test here
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Sep 25, 2023
1 parent 7254363 commit c240643
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import warnings

import dagster._check as check
from dagster import OpExecutionContext, job, op
import pytest
from dagster import AssetExecutionContext, OpExecutionContext, job, op
from dagster._core.definitions.job_definition import JobDefinition
from dagster._core.definitions.op_definition import OpDefinition
from dagster._core.storage.dagster_run import DagsterRun
Expand All @@ -20,3 +23,24 @@ def foo():
ctx_op()

assert foo.execute_in_process().success


def test_instance_check():
# turn off any outer warnings filters, e.g. ignores that are set in pyproject.toml
warnings.resetwarnings()
warnings.filterwarnings("error")

@op
def test_op_context_instance_check(context: OpExecutionContext):
step_context = context._step_execution_context # noqa: SLF001
asset_context = AssetExecutionContext(step_execution_context=step_context)
op_context = OpExecutionContext(step_execution_context=step_context)
with pytest.raises(DeprecationWarning):
isinstance(asset_context, OpExecutionContext)
assert isinstance(op_context, OpExecutionContext)

@job
def test_isinstance():
test_op_context_instance_check()

test_isinstance.execute_in_process()

0 comments on commit c240643

Please sign in to comment.