-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpip-sync.test.ts
More file actions
60 lines (56 loc) · 1.87 KB
/
Copy pathpip-sync.test.ts
File metadata and controls
60 lines (56 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { PluginTester, testSpawn } from '@codifycli/plugin-test';
import * as path from 'node:path';
import * as fs from 'node:fs/promises';
import * as os from 'node:os';
import { afterAll, describe, expect, it } from 'vitest'
describe('Pip-sync resource integration tests', () => {
const pluginPath = path.resolve('./src/index.ts');
it('Installs python', { timeout: 500_000 }, async () => {
await PluginTester.fullTest(pluginPath, [
{
type: 'uv',
pythonVersions: ['3.11'],
global: '3.11',
tools: ['pip'],
},
], {
skipUninstall: true,
validateApply: async () => {
expect(testSpawn('python --version')).resolves.toMatchObject({ data: expect.stringContaining('3.11') });
}
})
})
it('Installs python and installs packages via pip-sync (in venv)', { timeout: 300_000 }, async () => {
await PluginTester.fullTest(pluginPath, [
{
'type': 'git-repository',
'directory': '~/Projects/example-project2',
'repository': 'https://github.com/ImperialCollegeLondon/pip-tools-template.git'
},
{
'type': 'venv-project',
'envDir': '.venv',
'cwd': '~/Projects/example-project2',
'dependsOn': ['git-repository']
},
{
'type': 'pip-sync',
'cwd': '~/Projects/example-project2',
'requirementFiles': ['requirements.txt', 'dev-requirements.txt'],
'virtualEnv': '.venv',
'dependsOn': ['venv-project']
},
], {
skipUninstall: true,
skipImport: true,
validatePlan(plans) {
console.log(JSON.stringify(plans, null, 2))
},
validateApply() {},
});
});
afterAll(async () => {
await fs.rm(path.join(os.homedir(), 'Projects', 'example-project2'), { recursive: true, force: true });
await PluginTester.uninstall(pluginPath, [{ type: 'uv' }]);
}, 120_000);
})