-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from lyft/fix-hive-unit-test
Implement Hive Unit Test Behavior
- Loading branch information
Showing
4 changed files
with
97 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from __future__ import absolute_import | ||
import flytekit.plugins | ||
|
||
__version__ = '0.1.5' | ||
__version__ = '0.1.6' |
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
44 changes: 44 additions & 0 deletions
44
tests/flytekit/unit/use_scenarios/unit_testing/hive_tasks.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,44 @@ | ||
from __future__ import absolute_import | ||
from flytekit.sdk.tasks import hive_task | ||
import pytest | ||
|
||
|
||
def test_no_queries(): | ||
@hive_task | ||
def test_hive_task(wf_params): | ||
pass | ||
|
||
assert test_hive_task.unit_test() == [] | ||
|
||
|
||
def test_empty_list_queries(): | ||
@hive_task | ||
def test_hive_task(wf_params): | ||
return [] | ||
|
||
assert test_hive_task.unit_test() == [] | ||
|
||
|
||
def test_one_query(): | ||
@hive_task | ||
def test_hive_task(wf_params): | ||
return "abc" | ||
|
||
assert test_hive_task.unit_test() == ["abc"] | ||
|
||
|
||
def test_multiple_queries(): | ||
@hive_task | ||
def test_hive_task(wf_params): | ||
return ["abc", "cde"] | ||
|
||
assert test_hive_task.unit_test() == ["abc", "cde"] | ||
|
||
|
||
def test_raise_exception(): | ||
@hive_task | ||
def test_hive_task(wf_params): | ||
raise FloatingPointError("Floating point error for some reason.") | ||
|
||
with pytest.raises(FloatingPointError): | ||
test_hive_task.unit_test() |