-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
assorted sensor and schedule fixes (#6759)
- Loading branch information
jamiedemaria
committed
Mar 3, 2022
1 parent
919fb31
commit 498b261
Showing
7 changed files
with
121 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
python_modules/dagster/dagster_tests/core_tests/definitions_tests/test_sensor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import pytest | ||
|
||
from dagster import SensorDefinition, graph | ||
from dagster.core.errors import DagsterInvalidDefinitionError | ||
|
||
|
||
def test_jobs_attr(): | ||
def eval_fn(): | ||
pass | ||
|
||
@graph | ||
def my_graph(): | ||
pass | ||
|
||
sensor = SensorDefinition(evaluation_fn=eval_fn, job=my_graph) | ||
assert sensor.job.name == my_graph.name | ||
|
||
sensor = SensorDefinition(evaluation_fn=eval_fn, pipeline_name="my_pipeline") | ||
with pytest.raises( | ||
DagsterInvalidDefinitionError, match="No job was provided to SensorDefinition." | ||
): | ||
sensor.job | ||
|
||
@graph | ||
def my_second_graph(): | ||
pass | ||
|
||
sensor = SensorDefinition(evaluation_fn=eval_fn, jobs=[my_graph, my_second_graph]) | ||
with pytest.raises( | ||
DagsterInvalidDefinitionError, | ||
match="Job property not available when SensorDefinition has multiple jobs.", | ||
): | ||
sensor.job | ||
|
||
|
||
def test_direct_sensor_definition_instantiation(): | ||
with pytest.raises( | ||
DagsterInvalidDefinitionError, match="Must provide evaluation_fn to SensorDefinition." | ||
): | ||
SensorDefinition() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters