Skip to content

Commit

Permalink
remove irrelevant tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sryza committed Aug 20, 2024
1 parent 9bfad11 commit d8a9aa5
Showing 1 changed file with 1 addition and 113 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
from dagster import (
AssetKey,
ConfigurableResource,
Definitions,
StaticPartitionsDefinition,
asset,
job,
op,
static_partitioned_config,
)
from dagster import Definitions, job, op, static_partitioned_config
from dagster._core.definitions.repository_definition import SINGLETON_REPOSITORY_NAME
from dagster._core.test_utils import ensure_dagster_tests_import, instance_for_test
from dagster_graphql.test.utils import define_out_of_process_context, execute_dagster_graphql
Expand Down Expand Up @@ -83,26 +74,6 @@ def job1():
return Definitions(jobs=[job1]).get_repository_def()


def get_repo_with_differently_partitioned_assets():
@asset(partitions_def=StaticPartitionsDefinition(["1", "2"]))
def asset1(): ...

ab_partitions_def = StaticPartitionsDefinition(["a", "b"])

@asset(partitions_def=ab_partitions_def)
def asset2(): ...

class MyResource(ConfigurableResource):
foo: str

@asset(partitions_def=ab_partitions_def)
def asset3(resource1: MyResource): ...

return Definitions(
assets=[asset1, asset2, asset3], resources={"resource1": MyResource(foo="bar")}
).get_repository_def()


def test_get_partition_names():
with instance_for_test() as instance:
with define_out_of_process_context(
Expand All @@ -126,33 +97,6 @@ def test_get_partition_names():
]


def test_get_partition_names_asset_selection():
with instance_for_test() as instance:
with define_out_of_process_context(
__file__, "get_repo_with_differently_partitioned_assets", instance
) as context:
result = execute_dagster_graphql(
context,
GET_PARTITIONS_QUERY,
variables={
"selector": {
"repositoryLocationName": context.code_location_names[0],
"repositoryName": SINGLETON_REPOSITORY_NAME,
"pipelineName": "__ASSET_JOB",
},
"selectedAssetKeys": [
AssetKey("asset2").to_graphql_input(),
AssetKey("asset3").to_graphql_input(),
],
},
)
assert result.data["pipelineOrError"]["name"] == "__ASSET_JOB"
assert result.data["pipelineOrError"]["partitionKeysOrError"]["partitionKeys"] == [
"a",
"b",
]


def test_get_partition_tags():
with instance_for_test() as instance:
with define_out_of_process_context(
Expand Down Expand Up @@ -181,35 +125,6 @@ def test_get_partition_tags():
}


def test_get_partition_tags_asset_selection():
with instance_for_test() as instance:
with define_out_of_process_context(
__file__, "get_repo_with_differently_partitioned_assets", instance
) as context:
result = execute_dagster_graphql(
context,
GET_PARTITION_TAGS_QUERY,
variables={
"selector": {
"repositoryLocationName": context.code_location_names[0],
"repositoryName": SINGLETON_REPOSITORY_NAME,
"pipelineName": "__ASSET_JOB",
},
"selectedAssetKeys": [
AssetKey("asset2").to_graphql_input(),
AssetKey("asset3").to_graphql_input(),
],
"partitionName": "b",
},
)
assert result.data["pipelineOrError"]["name"] == "__ASSET_JOB"
result_partition = result.data["pipelineOrError"]["partition"]
assert result_partition["name"] == "b"
assert {
item["key"]: item["value"] for item in result_partition["tagsOrError"]["results"]
} == {"dagster/partition": "b"}


def test_get_partition_config():
with instance_for_test() as instance:
with define_out_of_process_context(
Expand All @@ -234,30 +149,3 @@ def test_get_partition_config():
result_partition["runConfigOrError"]["yaml"]
== """ops:\n op1:\n config:\n p: '1'\n"""
)


def test_get_partition_config_asset_selection():
with instance_for_test() as instance:
with define_out_of_process_context(
__file__, "get_repo_with_differently_partitioned_assets", instance
) as context:
result = execute_dagster_graphql(
context,
GET_PARTITION_RUN_CONFIG_QUERY,
variables={
"selector": {
"repositoryLocationName": context.code_location_names[0],
"repositoryName": SINGLETON_REPOSITORY_NAME,
"pipelineName": "__ASSET_JOB",
},
"selectedAssetKeys": [
AssetKey("asset2").to_graphql_input(),
AssetKey("asset3").to_graphql_input(),
],
"partitionName": "b",
},
)
assert result.data["pipelineOrError"]["name"] == "__ASSET_JOB"
result_partition = result.data["pipelineOrError"]["partition"]
assert result_partition["name"] == "b"
assert result_partition["runConfigOrError"]["yaml"] == "{}\n"

0 comments on commit d8a9aa5

Please sign in to comment.