MCPcopy
hub / github.com/smittix/intercept / setup_db

Method setup_db

tests/test_agent.py:488–508  ·  view source on GitHub ↗

Set up a temporary database for each test.

(self, tmp_path)

Source from the content-addressed store, hash-verified

486
487 @pytest.fixture(autouse=True)
488 def setup_db(self, tmp_path):
489 """Set up a temporary database for each test."""
490 import utils.database as db_module
491
492 test_db_path = tmp_path / 'test.db'
493 original_db_path = db_module.DB_PATH
494 db_module.DB_PATH = test_db_path
495 db_module.DB_DIR = tmp_path
496
497 if hasattr(db_module._local, 'connection') and db_module._local.connection:
498 db_module._local.connection.close()
499 db_module._local.connection = None
500
501 init_db()
502
503 yield
504
505 if hasattr(db_module._local, 'connection') and db_module._local.connection:
506 db_module._local.connection.close()
507 db_module._local.connection = None
508 db_module.DB_PATH = original_db_path
509
510 def test_store_push_payload(self):
511 """store_push_payload should insert payload."""

Callers

nothing calls this directly

Calls 2

init_dbFunction · 0.90
closeMethod · 0.45

Tested by

no test coverage detected