Skip to content

Commit

Permalink
Fix some lines too long for PEP8
Browse files Browse the repository at this point in the history
  • Loading branch information
balexander authored and jcampbell committed May 18, 2020
1 parent 0cb5a73 commit 917495e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
14 changes: 11 additions & 3 deletions great_expectations/data_context/data_context.py
Expand Up @@ -117,7 +117,11 @@ def validate_config(cls, project_config):
return True

@usage_statistics_enabled_method(event_name="data_context.__init__",)
def __init__(self, project_config, context_root_dir=None, runtime_config_substitutions={}):
def __init__(
self,
project_config,
context_root_dir=None,
runtime_config_substitutions=None):
"""DataContext constructor
Args:
Expand All @@ -139,7 +143,7 @@ def __init__(self, project_config, context_root_dir=None, runtime_config_substit
self._context_root_directory = os.path.abspath(context_root_dir)
else:
self._context_root_directory = context_root_dir
self.runtime_config_substitutions = runtime_config_substitutions
self.runtime_config_substitutions = runtime_config_substitutions or {}

# Init plugin support
if self.plugins_directory is not None:
Expand Down Expand Up @@ -1881,7 +1885,11 @@ class DataContext(BaseDataContext):
"""

@classmethod
def create(cls, project_root_dir=None, usage_statistics_enabled=True, runtime_config_substitutions={}):
def create(
cls,
project_root_dir=None,
usage_statistics_enabled=True,
runtime_config_substitutions=None):
"""
Build a new great_expectations directory and DataContext object in the provided project_root_dir.
Expand Down
11 changes: 8 additions & 3 deletions tests/data_context/conftest.py
Expand Up @@ -30,7 +30,10 @@ def data_context_with_variables_in_config(tmp_path_factory):
return ge.data_context.DataContext(context_path)


def create_data_context_files(context_path, asset_config_path, with_config_variables_file):
def create_data_context_files(
context_path,
asset_config_path,
with_config_variables_file):
if with_config_variables_file:
os.makedirs(context_path, exist_ok=True)
os.makedirs(os.path.join(context_path, "uncommitted"), exist_ok=True)
Expand Down Expand Up @@ -58,7 +61,8 @@ def create_common_data_context_files(context_path, asset_config_path):
)
copy_relative_path(
"../test_fixtures/expectation_suites/parameterized_expectation_suite_fixture.json",
os.path.join(asset_config_path, "mydatasource/mygenerator/my_dag_node/default.json"),
os.path.join(asset_config_path,
"mydatasource/mygenerator/my_dag_node/default.json"),
)
os.makedirs(os.path.join(context_path, "plugins"), exist_ok=True)
copy_relative_path(
Expand All @@ -67,7 +71,8 @@ def create_common_data_context_files(context_path, asset_config_path):
)
copy_relative_path(
"../test_fixtures/custom_sqlalchemy_dataset.py",
str(os.path.join(context_path, "plugins", "custom_sqlalchemy_dataset.py")),
str(os.path.join(context_path, "plugins",
"custom_sqlalchemy_dataset.py")),
)
copy_relative_path(
"../test_fixtures/custom_sparkdf_dataset.py",
Expand Down
10 changes: 7 additions & 3 deletions tests/data_context/test_data_context_config_variables.py
Expand Up @@ -110,13 +110,17 @@ def test_runtime_config_substitutions_are_used_preferentially(tmp_path_factory):
asset_config_path = os.path.join(context_path, "expectations")
create_data_context_files(context_path, asset_config_path, True)

data_context = ge.data_context.DataContext(context_path, runtime_config_substitutions=runtime_config_substitutions)
data_context = ge.data_context.DataContext(
context_path,
runtime_config_substitutions=runtime_config_substitutions)
config = data_context.get_config_with_variables_substituted()

try:
assert (config.datasources["mydatasource"]["batch_kwargs_generators"]["mygenerator"]["reader_options"][
assert (config.datasources["mydatasource"]["batch_kwargs_generators"][
"mygenerator"]["reader_options"][
"test_variable_sub1"] == value_from_runtime_override)
assert (config.datasources["mydatasource"]["batch_kwargs_generators"]["mygenerator"]["reader_options"][
assert (config.datasources["mydatasource"]["batch_kwargs_generators"][
"mygenerator"]["reader_options"][
"test_variable_sub2"] == value_from_runtime_override)
except Exception:
raise
Expand Down

0 comments on commit 917495e

Please sign in to comment.