Fix MCP server integration tests - add env variable propagation
- Fix BdCliClient._run_command() to pass BEADS_DIR/BEADS_DB env vars to subprocess - Update temp_db fixture to create .beads in workspace and return .beads dir path - Update mcp_client fixture to use beads_dir and enable BEADS_NO_DAEMON mode - Simplify test_init_tool to work with connection pool architecture Result: All 19 integration tests now pass (was 19 failing) Amp-Thread-ID: https://ampcode.com/threads/T-c1da2a55-f086-4284-9c85-0dfa4c479cf9 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -226,9 +226,15 @@ class BdCliClient(BdClientBase):
|
||||
cmd = [self.bd_path, *args, *self._global_flags(), "--json"]
|
||||
working_dir = cwd if cwd is not None else self._get_working_dir()
|
||||
|
||||
# Set up environment with database configuration
|
||||
env = os.environ.copy()
|
||||
if self.beads_dir:
|
||||
env["BEADS_DIR"] = self.beads_dir
|
||||
elif self.beads_db:
|
||||
env["BEADS_DB"] = self.beads_db
|
||||
|
||||
# Log database routing for debugging
|
||||
import sys
|
||||
working_dir = self._get_working_dir()
|
||||
if self.beads_dir:
|
||||
db_info = f"BEADS_DIR={self.beads_dir}"
|
||||
elif self.beads_db:
|
||||
@@ -245,6 +251,7 @@ class BdCliClient(BdClientBase):
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
cwd=working_dir,
|
||||
env=env,
|
||||
)
|
||||
stdout, stderr = await process.communicate()
|
||||
except FileNotFoundError as e:
|
||||
|
||||
Reference in New Issue
Block a user