Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions test/lib/hooks/telemetry/detectEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@ describe('detectAiAgent', () => {
'OPENCLAW_SHELL',
];

afterEach(() => {
beforeEach(() => {
// The suite itself may run inside one of these agents, so clear the vars before each test
for (const key of agentEnvVars) {
delete process.env[key];
vi.stubEnv(key, undefined);
}
});

afterEach(() => {
vi.unstubAllEnvs();
});

test('returns undefined when no agent env vars are set', () => {
expect(detectAiAgent()).toBeUndefined();
});
Expand Down
12 changes: 6 additions & 6 deletions test/local/__fixtures__/python_support.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const actorName = 'my-python-actor';
const PYTHON_START_TEMPLATE_ID = 'python-start';
const { beforeAllCalls, afterAllCalls, joinPath, tmpPath, toggleCwdBetweenFullAndParentPath } = useTempPath(actorName, {
create: true,
remove: false,
remove: true,
cwd: true,
cwdParent: true,
});
Expand All @@ -34,6 +34,11 @@ describe('[python] Python support', () => {
});

it('should work', { timeout: TEST_TIMEOUT }, async () => {
if (existsSync(tmpPath)) {
// Remove the tmp path before detecting the runtime, so a leftover .venv is not picked up
await rm(tmpPath, { recursive: true, force: true });
}

const runtime = await usePythonRuntime({ cwd: tmpPath, force: true });

const pythonVersion = runtime.map((r) => r.version).unwrapOr(undefined);
Expand All @@ -44,11 +49,6 @@ describe('[python] Python support', () => {
return;
}

if (existsSync(tmpPath)) {
// Remove the tmp path if it exists
await rm(tmpPath, { recursive: true, force: true });
}

await testRunCommand(CreateCommand, {
args_actorName: actorName,
flags_template: PYTHON_START_TEMPLATE_ID,
Expand Down
Loading