MCPcopy
hub / github.com/phuryn/claude-usage / setUp

Method setUp

tests/test_dashboard.py:134–156  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

132 NULLIF(model, '') is needed first."""
133
134 def setUp(self):
135 self.tmpfile = tempfile.NamedTemporaryFile(suffix=".db", delete=False)
136 self.tmpfile.close()
137 self.db_path = Path(self.tmpfile.name)
138 conn = get_db(self.db_path)
139 init_db(conn)
140 upsert_sessions(conn, [{
141 "session_id": "sess-empty", "project_name": "u/p",
142 "first_timestamp": "2026-04-08T09:00:00Z",
143 "last_timestamp": "2026-04-08T09:05:00Z",
144 "git_branch": "", "model": "",
145 "total_input_tokens": 100, "total_output_tokens": 50,
146 "total_cache_read": 0, "total_cache_creation": 0,
147 "turn_count": 1,
148 }])
149 insert_turns(conn, [{
150 "session_id": "sess-empty", "timestamp": "2026-04-08T09:05:00Z",
151 "model": "", "input_tokens": 100, "output_tokens": 50,
152 "cache_read_tokens": 0, "cache_creation_tokens": 0,
153 "tool_name": None, "cwd": "/tmp",
154 }])
155 conn.commit()
156 conn.close()
157
158 def tearDown(self):
159 os.unlink(self.db_path)

Callers

nothing calls this directly

Calls 4

get_dbFunction · 0.90
init_dbFunction · 0.90
upsert_sessionsFunction · 0.90
insert_turnsFunction · 0.90

Tested by

no test coverage detected