MCPcopy Index your code
hub / github.com/langbot-app/LangBot / start

Method start

tests/e2e/utils/process_manager.py:40–143  ·  view source on GitHub ↗

Start LangBot process and wait for it to be ready.

(self)

Source from the content-addressed store, hash-verified

38 self._coverage_file: Optional[Path] = None
39
40 def start(self) -> bool:
41 """Start LangBot process and wait for it to be ready."""
42 import httpx
43
44 # Prepare environment
45 env = os.environ.copy()
46 env['PYTHONPATH'] = str(self.project_root / 'src')
47 for proxy_key in (
48 'HTTP_PROXY',
49 'HTTPS_PROXY',
50 'ALL_PROXY',
51 'http_proxy',
52 'https_proxy',
53 'all_proxy',
54 ):
55 env.pop(proxy_key, None)
56 env['NO_PROXY'] = '127.0.0.1,localhost'
57 env['no_proxy'] = '127.0.0.1,localhost'
58
59 # Set API port via environment variable
60 env['API__PORT'] = str(self.port)
61 env['API__WEBHOOK_PREFIX'] = f'http://127.0.0.1:{self.port}'
62
63 # Disable telemetry
64 env['SPACE__DISABLE_TELEMETRY'] = 'true'
65 env['SPACE__DISABLE_MODELS_SERVICE'] = 'true'
66
67 # Build command
68 if self.collect_coverage:
69 # Use coverage.py to collect coverage data
70 # Set COVERAGE_PROCESS_START to enable coverage in subprocess
71 self._coverage_file = self.work_dir / '.coverage.e2e'
72 env['COVERAGE_PROCESS_START'] = str(self.project_root / '.coveragerc')
73 env['COVERAGE_FILE'] = str(self._coverage_file)
74
75 # Create .coveragerc for subprocess
76 coveragerc_content = """
77[run]
78source = langbot.pkg
79parallel = True
80data_file = {}
81omit =
82 */tests/*
83 */test_*.py
84
85[report]
86precision = 2
87""".format(str(self._coverage_file))
88 coveragerc_path = self.work_dir / '.coveragerc'
89 with open(coveragerc_path, 'w') as f:
90 f.write(coveragerc_content)
91
92 cmd = [
93 'coverage',
94 'run',
95 '--rcfile=' + str(coveragerc_path),
96 '-m',
97 'langbot',

Callers 3

langbot_processFunction · 0.95
mainFunction · 0.45

Calls 6

stopMethod · 0.95
strFunction · 0.85
copyMethod · 0.80
infoMethod · 0.45
errorMethod · 0.45
decodeMethod · 0.45

Tested by 2

langbot_processFunction · 0.76