Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis-Mittenzwei committed Dec 12, 2024
1 parent 5a0df94 commit 50bd4c0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
19 changes: 9 additions & 10 deletions exasol/toolbox/nox/_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def check_artifacts(session: Session) -> None:
"""Validate that all project artifacts are available and consistent"""
if not_available := _missing_files(
{".lint.json", ".lint.txt", ".security.json", ".coverage"}, PROJECT_CONFIG.root
{".lint.json", ".lint.txt", ".security.json", ".coverage"}, PROJECT_CONFIG.root
):
print(f"not available: {not_available}")
sys.exit(1)
Expand Down Expand Up @@ -64,9 +64,7 @@ def _validate_lint_json(file: Path) -> str:
actual = set(issue.keys())
missing = expected - actual
if len(missing) > 0:
return (
f"Invalid format, issue {number} is missing the following attributes {missing}"
)
return f"Invalid format, issue {number} is missing the following attributes {missing}"
return ""


Expand All @@ -82,9 +80,7 @@ def _validate_security_json(file: Path) -> str:
expected = {"errors", "generated_at", "metrics", "results"}
missing = expected - actual
if len(missing) > 0:
return (
f"Invalid format, the file is missing the following attributes {missing}"
)
return f"Invalid format, the file is missing the following attributes {missing}"
return ""


Expand All @@ -95,13 +91,16 @@ def _validate_coverage(path: Path) -> str:
return f"database connection not possible, details: {ex}"
cursor = conn.cursor()
try:
actual_tables = set(cursor.execute("select name from sqlite_schema where type == 'table'"))
actual_tables = set(
cursor.execute("select name from sqlite_schema where type == 'table'")
)
except sqlite3.Error as ex:
return f"schema query not possible, details: {ex}"
expected = {"coverage_schema", "meta", "file", "line_bits"}
actual = {f[0] for f in actual_tables if (f[0] in expected)}
missing = expected - actual
if len(missing) > 0:
return f"Invalid database, the database is missing the following tables {missing}"
return (
f"Invalid database, the database is missing the following tables {missing}"
)
return ""

23 changes: 9 additions & 14 deletions test/unit/lint_file_check_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,25 +252,22 @@ def test_check_lint_json(attributes, expected, tmp_path):
@pytest.mark.parametrize(
"attributes,expected",
[
(
["errors", "generated_at", "metrics", "results"],
""
),
(["errors", "generated_at", "metrics", "results"], ""),
(
["generated_at", "metrics", "results"],
"Invalid format, the file is missing the following attributes {'errors'}"
"Invalid format, the file is missing the following attributes {'errors'}",
),
(
["errors", "metrics", "results"],
"Invalid format, the file is missing the following attributes {'generated_at'}"
"Invalid format, the file is missing the following attributes {'generated_at'}",
),
(
["errors", "generated_at", "results"],
"Invalid format, the file is missing the following attributes {'metrics'}"
"Invalid format, the file is missing the following attributes {'metrics'}",
),
(
["errors", "generated_at", "metrics"],
"Invalid format, the file is missing the following attributes {'results'}"
"Invalid format, the file is missing the following attributes {'results'}",
),
],
)
Expand All @@ -289,20 +286,18 @@ def test_check_security_json(attributes, expected, tmp_path):
@pytest.mark.parametrize(
"tables, expected",
[
(
["coverage_schema", "meta", "file", "line_bits"], ""
),
(["coverage_schema", "meta", "file", "line_bits"], ""),
(
["meta", "file", "line_bits"],
"Invalid database, the database is missing the following tables {'coverage_schema'}"
"Invalid database, the database is missing the following tables {'coverage_schema'}",
),
(
["coverage_schema", "file", "line_bits"],
"Invalid database, the database is missing the following tables {'meta'}"
"Invalid database, the database is missing the following tables {'meta'}",
),
(
["coverage_schema", "meta", "line_bits"],
"Invalid database, the database is missing the following tables {'file'}"
"Invalid database, the database is missing the following tables {'file'}",
),
(
[
Expand Down

0 comments on commit 50bd4c0

Please sign in to comment.