Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayak-mehta committed Nov 21, 2024
1 parent 92ee329 commit 40ff2fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
4 changes: 1 addition & 3 deletions src/houseplant/houseplant.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ def __init__(self):

def init(self):
"""Initialize a new houseplant project."""
with self.console.status(
"[bold green]Initializing new houseplant project..."
):
with self.console.status("[bold green]Initializing new houseplant project..."):
os.makedirs("ch/migrations", exist_ok=True)
open("ch/schema.sql", "a").close()

Expand Down
23 changes: 7 additions & 16 deletions tests/test_clickhouse_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def test_execute_migration(ch_client):
ch_client.execute_migration(test_sql)

result = ch_client.client.execute("""
SELECT name
FROM system.tables
SELECT name
FROM system.tables
WHERE database = currentDatabase() AND name = 'test_table'
""")

Expand Down Expand Up @@ -95,17 +95,8 @@ def test_get_database_schema(ch_client):

schema = ch_client.get_database_schema()

assert "schema_migrations" not in schema["tables"]
assert "test_table" in schema["tables"]
assert schema["tables"]["test_table"]["engine"] == "MergeTree"
assert schema["tables"]["test_table"]["primary_key"] == "id"
assert schema["tables"]["test_table"]["sorting_key"] == "id"

columns = schema["tables"]["test_table"]["columns"]
assert "id" in columns
assert columns["id"]["type"] == "UInt32"
assert not columns["id"]["default_value"]

assert "name" in columns
assert columns["name"]["type"] == "String"
assert not columns["name"]["default_value"]
assert schema["version"] == "0"
assert len(schema["tables"]) == 1
assert schema["tables"][0].startswith("CREATE TABLE houseplant_test_")
assert "test_table" in schema["tables"][0]
assert "ENGINE = MergeTree" in schema["tables"][0]

0 comments on commit 40ff2fe

Please sign in to comment.