forked from flyteorg/flytekit
-
Notifications
You must be signed in to change notification settings - Fork 0
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 flyteorg#3 from honnix/patch-2
Make config file optional
- Loading branch information
Showing
7 changed files
with
68 additions
and
18 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 |
---|---|---|
|
@@ -16,4 +16,4 @@ build/ | |
.ipynb_checkpoints/ | ||
.pytest_cache/ | ||
dist | ||
|
||
*.iml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pytest | ||
mock | ||
six |
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
37 changes: 37 additions & 0 deletions
37
tests/flytekit/unit/configuration/test_temporary_configuration.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,37 @@ | ||
from __future__ import absolute_import | ||
from flytekit.configuration import set_flyte_config_file as _set_flyte_config_file, \ | ||
common as _common, \ | ||
TemporaryConfiguration as _TemporaryConfiguration | ||
import os as _os | ||
|
||
|
||
def test_configuration_file(): | ||
with _TemporaryConfiguration( | ||
_os.path.join(_os.path.dirname(_os.path.realpath(__file__)), 'configs/good.config')): | ||
assert _common.CONFIGURATION_SINGLETON.get_string('sdk', 'workflow_packages') == \ | ||
'this.module,that.module' | ||
assert _common.CONFIGURATION_SINGLETON.get_string('sdk', 'workflow_packages') is None | ||
|
||
|
||
def test_internal_overrides(): | ||
with _TemporaryConfiguration( | ||
_os.path.join(_os.path.dirname(_os.path.realpath(__file__)), 'configs/good.config'), | ||
{'foo': 'bar'}): | ||
assert _os.environ.get('FLYTE_INTERNAL_FOO') == 'bar' | ||
assert _os.environ.get('FLYTE_INTERNAL_FOO') is None | ||
|
||
|
||
def test_no_configuration_file(): | ||
_set_flyte_config_file(_os.path.join(_os.path.dirname(_os.path.realpath(__file__)), 'configs/good.config')) | ||
with _TemporaryConfiguration(None): | ||
assert _common.CONFIGURATION_SINGLETON.get_string('sdk', 'workflow_packages') is None | ||
assert _common.CONFIGURATION_SINGLETON.get_string('sdk', 'workflow_packages') == \ | ||
'this.module,that.module' | ||
|
||
|
||
def test_nonexist_configuration_file(): | ||
_set_flyte_config_file(_os.path.join(_os.path.dirname(_os.path.realpath(__file__)), 'configs/good.config')) | ||
with _TemporaryConfiguration('/foo/bar'): | ||
assert _common.CONFIGURATION_SINGLETON.get_string('sdk', 'workflow_packages') is None | ||
assert _common.CONFIGURATION_SINGLETON.get_string('sdk', 'workflow_packages') == \ | ||
'this.module,that.module' |