MCPcopy
hub / github.com/langbot-app/LangBot / langbot_process

Function langbot_process

tests/e2e/conftest.py:51–85  ·  view source on GitHub ↗

Start real LangBot process for E2E testing. This fixture starts LangBot once per session and reuses it for all tests. Coverage data is collected from the subprocess.

(e2e_config_path, e2e_port, e2e_tmpdir)

Source from the content-addressed store, hash-verified

49
50@pytest.fixture(scope='session')
51def langbot_process(e2e_config_path, e2e_port, e2e_tmpdir):
52 """Start real LangBot process for E2E testing.
53
54 This fixture starts LangBot once per session and reuses it for all tests.
55 Coverage data is collected from the subprocess.
56 """
57 project_root = find_project_root()
58 collect_coverage = True
59
60 proc = LangBotProcess(
61 project_root=project_root,
62 work_dir=e2e_tmpdir, # Run in tmpdir where data/config.yaml exists
63 port=e2e_port,
64 timeout=60, # Longer timeout for first startup
65 collect_coverage=collect_coverage,
66 )
67
68 success = proc.start()
69 if not success:
70 stdout, stderr = proc.get_logs()
71 pytest.fail(f'LangBot failed to start:\nstdout: {stdout}\nstderr: {stderr}')
72
73 yield proc
74
75 # Cleanup
76 proc.stop()
77
78 # Combine coverage data if collected
79 if collect_coverage and proc.get_coverage_file():
80 coverage_file = proc.get_coverage_file()
81 if coverage_file.exists():
82 # Copy coverage data to project root for combining
83 target = project_root / '.coverage.e2e'
84 shutil.copy(coverage_file, target)
85 logger.info(f'Coverage data saved to: {target}')
86
87
88@pytest.fixture

Callers

nothing calls this directly

Calls 10

startMethod · 0.95
get_logsMethod · 0.95
stopMethod · 0.95
get_coverage_fileMethod · 0.95
find_project_rootFunction · 0.90
LangBotProcessClass · 0.90
failMethod · 0.80
copyMethod · 0.80
existsMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected