Skip to content

Commit

Permalink
Updated Test cases Plus Ruff formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-tmathew committed Mar 26, 2024
1 parent 54f178d commit 5d5b855
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion tests/test_JinjaEnvVar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_env_var_with_no_default_and_no_environmental_variables_should_raise_exc
assert ("SF_DATABASE" in os.environ) is False

with pytest.raises(ValueError) as e:
result = JinjaEnvVar.env_var("SF_DATABASE")
JinjaEnvVar.env_var("SF_DATABASE")
assert (
str(e.value)
== "Could not find environmental variable SF_DATABASE and no default value was provided"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_JinjaTemplateProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_JinjaTemplateProcessor_render_simple_string_expecting_variable_that_doe
processor.override_loader(DictLoader(templates))

with pytest.raises(UndefinedError) as e:
context = processor.render("test.sql", None, True)
processor.render("test.sql", None, True)

assert str(e.value) == "'myvar' is undefined"

Expand Down
8 changes: 4 additions & 4 deletions tests/test_extract_config_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from schemachange.cli import extract_config_secrets


def test_extract_config_secrets_given_empty_config_should_not_error():
def test_extract_config_secrets_given_empty_config_should_produce_empty_set():
config = {}
results = extract_config_secrets(config)
assert len(extract_config_secrets(config)) == 0


def test_extract_config_secrets_given_None_should_not_error():
results = extract_config_secrets(None)
def test_extract_config_secrets_given_None_should_produce_empty_set():
assert len(extract_config_secrets(None)) == 0


@pytest.mark.parametrize(
Expand Down
12 changes: 6 additions & 6 deletions tests/test_get_all_scripts_recursively.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_get_all_scripts_recursively__given_same_Version_twice_should_raise_exce
]

with pytest.raises(ValueError) as e:
result = get_all_scripts_recursively("scripts", False)
get_all_scripts_recursively("scripts", False)
assert str(e.value).startswith(
"The script version 1.1.1 exists more than once (second instance"
)
Expand Down Expand Up @@ -109,7 +109,7 @@ def test_get_all_scripts_recursively__given_same_version_file_with_and_without_j
]

with pytest.raises(ValueError) as e:
result = get_all_scripts_recursively("scripts", False)
get_all_scripts_recursively("scripts", False)
assert str(e.value).startswith(
"The script name V1.1.1__intial.sql exists more than once (first_instance"
)
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_get_all_scripts_recursively__given_same_Always_file_should_raise_except
]

with pytest.raises(ValueError) as e:
result = get_all_scripts_recursively("scripts", False)
get_all_scripts_recursively("scripts", False)
assert str(e.value).startswith(
"The script name A__intial.sql exists more than once (first_instance "
)
Expand Down Expand Up @@ -193,7 +193,7 @@ def test_get_all_scripts_recursively__given_same_Always_file_with_and_without_ji
]

with pytest.raises(ValueError) as e:
result = get_all_scripts_recursively("scripts", False)
get_all_scripts_recursively("scripts", False)
assert str(e.value).startswith(
"The script name A__intial.sql exists more than once (first_instance "
)
Expand Down Expand Up @@ -228,7 +228,7 @@ def test_get_all_scripts_recursively__given_same_Repeatable_file_should_raise_ex
]

with pytest.raises(ValueError) as e:
result = get_all_scripts_recursively("scripts", False)
get_all_scripts_recursively("scripts", False)
assert str(e.value).startswith(
"The script name R__intial.sql exists more than once (first_instance "
)
Expand Down Expand Up @@ -277,7 +277,7 @@ def test_get_all_scripts_recursively__given_same_Repeatable_file_with_and_withou
]

with pytest.raises(ValueError) as e:
result = get_all_scripts_recursively("scripts", False)
get_all_scripts_recursively("scripts", False)
assert str(e.value).startswith(
"The script name R__intial.sql exists more than once (first_instance "
)
2 changes: 1 addition & 1 deletion tests/test_jinja_env_var_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_from_environ_not_set():
processor.override_loader(DictLoader(templates))

with pytest.raises(ValueError) as e:
context = processor.render("test.sql", None, True)
processor.render("test.sql", None, True)

assert (
str(e.value)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_load_schemachange_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def test__load_schemachange_config__requiring_env_var_but_env_var_not_set_should
config_file.write_text(config_contents)

with pytest.raises(ValueError) as e:
config = load_schemachange_config(str(config_file))
load_schemachange_config(str(config_file))
assert (
str(e.value)
== "Could not find environmental variable TEST_VAR and no default value was provided"
Expand Down

0 comments on commit 5d5b855

Please sign in to comment.