Skip to content

Commit ccb6cc1

Browse files
committed
fix: ruff format + use pytest for validate-macros CI step
Made-with: Cursor
1 parent bbf7d69 commit ccb6cc1

4 files changed

Lines changed: 14 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,4 @@ jobs:
138138
run: uv sync --dev
139139

140140
- name: Validate SQL macros
141-
run: uv run python tests/test_macros.py
141+
run: uv run pytest tests/test_macros.py -v

src/agent_farm/__main__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Entry point for python -m agent_farm."""
2+
23
from agent_farm.cli import cli
34

45
if __name__ == "__main__":

tests/test_macros.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def test_macros():
7676
# Register UDFs (getenv etc. – needed by macros); requires numpy for DuckDB create_function
7777
try:
7878
from agent_farm.udfs import register_udfs
79+
7980
register_udfs(con)
8081
except Exception as e:
8182
pytest.skip(f"UDFs not available: {e}")
@@ -103,13 +104,10 @@ def test_macros():
103104
print("\nLoading macros...")
104105
sql_dir = os.path.join("src", "agent_farm", "sql")
105106
all_files = [os.path.basename(p) for p in glob.glob(os.path.join(sql_dir, "*.sql"))]
106-
sql_files = [
107-
os.path.join(sql_dir, f)
108-
for f in SQL_LOAD_ORDER
109-
if f in all_files
110-
]
107+
sql_files = [os.path.join(sql_dir, f) for f in SQL_LOAD_ORDER if f in all_files]
111108
sql_files += sorted(
112-
p for p in glob.glob(os.path.join(sql_dir, "*.sql"))
109+
p
110+
for p in glob.glob(os.path.join(sql_dir, "*.sql"))
113111
if os.path.basename(p) not in SQL_LOAD_ORDER
114112
)
115113
if not sql_files:

tests/test_spec_engine.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,13 @@ def test_pia_agent_seeded(self, con):
162162

163163
def test_skills_seeded(self, con):
164164
"""Test that skills are seeded."""
165-
result = con.sql(
166-
"SELECT COUNT(*) FROM spec_objects WHERE kind = 'skill'"
167-
).fetchone()
165+
result = con.sql("SELECT COUNT(*) FROM spec_objects WHERE kind = 'skill'").fetchone()
168166
assert result is not None
169167
assert result[0] >= 3 # At least 3 skills
170168

171169
def test_schemas_seeded(self, con):
172170
"""Test that schemas are seeded."""
173-
result = con.sql(
174-
"SELECT COUNT(*) FROM spec_objects WHERE kind = 'schema'"
175-
).fetchone()
171+
result = con.sql("SELECT COUNT(*) FROM spec_objects WHERE kind = 'schema'").fetchone()
176172
assert result is not None
177173
assert result[0] >= 3 # At least 3 schemas
178174

@@ -186,9 +182,7 @@ def test_templates_seeded(self, con):
186182

187183
def test_orgs_seeded(self, con):
188184
"""Test that organizations are seeded."""
189-
result = con.sql(
190-
"SELECT COUNT(*) FROM spec_objects WHERE kind = 'org'"
191-
).fetchone()
185+
result = con.sql("SELECT COUNT(*) FROM spec_objects WHERE kind = 'org'").fetchone()
192186
assert result is not None
193187
assert result[0] >= 5 # All 5 orgs
194188

@@ -309,9 +303,7 @@ def test_spec_search(self, spec_engine):
309303
def test_validate_payload_success(self, spec_engine):
310304
"""Test validate_payload_against_spec with valid payload."""
311305
result = spec_engine.validate_payload_against_spec(
312-
kind="schema",
313-
name="agent_config_schema",
314-
payload={"name": "test", "role": "planner"}
306+
kind="schema", name="agent_config_schema", payload={"name": "test", "role": "planner"}
315307
)
316308
# Should succeed or have no schema (ok=True or note about no schema)
317309
assert "ok" in result or "note" in result
@@ -371,14 +363,12 @@ def test_view_consistency(self, full_setup):
371363
con = full_setup
372364

373365
# Count from table
374-
table_count = con.sql(
375-
"SELECT COUNT(*) FROM spec_objects WHERE kind = 'agent'"
376-
).fetchone()[0]
366+
table_count = con.sql("SELECT COUNT(*) FROM spec_objects WHERE kind = 'agent'").fetchone()[
367+
0
368+
]
377369

378370
# Count from view
379-
view_count = con.sql(
380-
"SELECT COUNT(*) FROM spec_agents_view"
381-
).fetchone()[0]
371+
view_count = con.sql("SELECT COUNT(*) FROM spec_agents_view").fetchone()[0]
382372

383373
assert table_count == view_count
384374

0 commit comments

Comments
 (0)