Skip to content

Commit

Permalink
coverage, pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dogversioning committed Jun 25, 2024
1 parent fd14ce3 commit 67302e7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cumulus_library/log_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def log_transaction(
__version__,
status.value,
base_utils.get_utc_datetime(),
message if message else None,
message or None,
]
],
)
Expand Down
2 changes: 1 addition & 1 deletion cumulus_library/template_sql/insert_into.sql.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ VALUES
{%- if table_cols[loop.index0] in type_casts.keys() -%}
{{ type_casts[table_cols[loop.index0]] }} '{{ field }}'
{%- elif not field -%}
NULL
CAST(NULL AS VARCHAR)
{%- else -%}
'{{ field }}'
{%- endif -%}
Expand Down
6 changes: 4 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ def test_cli_early_exit(args):
(
["build", "-t", "study_python_valid", "--builder", "module2"],
does_not_raise(),
"study_python_valid__table_2",
"study_python_valid__count_table",
),
(
["build", "-t", "study_bad_manifest"],
pytest.raises(errors.StudyManifestParsingError),
"study_python_valid__table_2",
"study_python_valid__count_table",
),
(["build", "-t", "wrong"], pytest.raises(SystemExit), None),
(
Expand Down Expand Up @@ -225,6 +225,8 @@ def test_generate_md(mock_path, tmp_path):
pathlib.Path(__file__).resolve().parent
/ "test_data/study_python_valid_generated.md"
)
with open(test_file) as f:
print(f.read())
assert filecmp.cmp(test_file, ref_file, shallow=True)


Expand Down
5 changes: 5 additions & 0 deletions tests/test_data/study_python_valid/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,8 @@ study_prefix = "study_python_valid"

[table_builder_config]
file_names = ["module1.py", "module1.py", "module2.py"]

[export_config]
export_list = [
"study_python_valid__count_table"
]
2 changes: 1 addition & 1 deletion tests/test_data/study_python_valid/module2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ class ModuleTwoRunner(BaseTableBuilder):

def prepare_queries(self, cursor: object, schema: str, *args, **kwargs):
self.queries.append(
"CREATE TABLE IF NOT EXISTS study_python_valid__table_2 (test int);"
"CREATE TABLE IF NOT EXISTS study_python_valid__count_table (test int);"
)
16 changes: 9 additions & 7 deletions tests/test_data/study_python_valid_generated.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## study_python_valid count tables

### study_python_valid__count_table

|Column| Type |Description|
|------|-------|-----------|
|test |INTEGER| |


## study_python_valid base tables

### study_python_valid__lib_transactions
Expand All @@ -18,10 +27,3 @@
|test |INTEGER| |


### study_python_valid__table_2

|Column| Type |Description|
|------|-------|-----------|
|test |INTEGER| |


0 comments on commit 67302e7

Please sign in to comment.