Skip to content

Commit 01b1306

Browse files
committed
Add python Wheels check for offline archives
1 parent c0a3702 commit 01b1306

File tree

3 files changed

+43
-7
lines changed

3 files changed

+43
-7
lines changed

tests/config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ logger.info(`Tools folder set to: ${TOOLSFOLDER}`);
130130
const runInDebug = (process.env.DEBUG || "false") === "true";
131131
logger.info(`Run in debug mode: ${runInDebug}`);
132132

133+
// Define versions of python Wheels included in the offline package
134+
let pythonWheelsVersion = ["311"]
135+
if (os.platform !== "win32") {
136+
pythonWheelsVersion.push("310", "312", "313")
137+
}
138+
logger.info(`Python wheels versions included: ${pythonWheelsVersion.join(", ")}`)
139+
140+
133141
export {
134142
IDFMIRRORS,
135143
TOOLSMIRRORS,
@@ -147,4 +155,5 @@ export {
147155
TOOLSFOLDER,
148156
pkgName,
149157
runInDebug,
158+
pythonWheelsVersion,
150159
};

tests/offlineRunner.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
INSTALLFOLDER,
2020
TOOLSFOLDER,
2121
pathToBuildInfo,
22+
pythonWheelsVersion,
2223
} from "./config.js";
2324
import path from "path";
2425
import fs from "fs";
@@ -69,6 +70,7 @@ function testRun(archiveInfo) {
6970
offlineIDFVersion: info.version,
7071
offlinePkgName: info.platform,
7172
testProxyMode: "block",
73+
pythonWheelsVersion,
7274
});
7375

7476
runInstallVerification({

tests/scripts/CLICustomInstall.test.js

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function runCLICustomInstallTest({
1414
offlinePkgName = null,
1515
testProxyMode = false,
1616
proxyBlockList = [],
17+
pythonWheelsVersion = [],
1718
}) {
1819
describe(`${id}- Run custom |`, function () {
1920
let testRunner = null;
@@ -31,13 +32,6 @@ export function runCLICustomInstallTest({
3132
idfVersion: offlineIDFVersion,
3233
packageName: offlinePkgName,
3334
});
34-
if (pathToOfflineArchive) {
35-
args.push(`--use-local-archive "${pathToOfflineArchive}"`);
36-
}
37-
}
38-
if (offlineIDFVersion && !pathToOfflineArchive) {
39-
logger.info(">>>>>>> Offline archive not found, skipping this test");
40-
this.skip();
4135
}
4236
if (testProxyMode) {
4337
try {
@@ -57,6 +51,15 @@ export function runCLICustomInstallTest({
5751
logger.info("Error to start terminal");
5852
logger.debug(`Error: ${error}`);
5953
}
54+
if (pathToOfflineArchive) {
55+
args.push(`--use-local-archive "${pathToOfflineArchive}"`);
56+
testRunner.sendInput("mkdir ~/archive");
57+
testRunner.sendInput(`tar -xf ${pathToOfflineArchive} -C ~/archive`);
58+
}
59+
if (offlineIDFVersion && !pathToOfflineArchive) {
60+
logger.info(">>>>>>> Offline archive not found, skipping this test");
61+
this.skip();
62+
}
6063
});
6164

6265
afterEach(function () {
@@ -90,13 +93,35 @@ export function runCLICustomInstallTest({
9093
if (pathToOfflineArchive) {
9194
try {
9295
fs.rmSync(pathToOfflineArchive, { force: true });
96+
fs.rmSync("~/archive", { recursive: true, force: true });
9397
logger.info(`Successfully deleted offline archive`);
9498
} catch (err) {
9599
logger.info(`Error deleting offline archive`);
96100
}
97101
}
98102
});
99103

104+
for (let pythonVersion of pythonWheelsVersion) {
105+
it(`0- Should verify wheels for python${pythonVersion} on offline archive`, function () {
106+
if (!offlineIDFVersion && !pathToOfflineArchive) {
107+
this.skip();
108+
}
109+
logger.info(`Verifying wheels for ${pythonVersion} on offline archive`);
110+
expect(
111+
fs.existsSync(pathToOfflineArchive),
112+
`Offline archive not found at ${pathToOfflineArchive}`
113+
).to.be.true;
114+
expect(
115+
fs.existsSync(`~/archive/wheels_py${pythonVersion}`),
116+
`Wheels folder for Python ${pythonVersion} not found in offline archive`
117+
).to.be.true;
118+
expect(
119+
fs.readdirSync(`~/archive/wheels_py${pythonVersion}`).length > 0,
120+
`No wheels found for Python ${pythonVersion} in offline archive`
121+
).to.be.true;
122+
});
123+
}
124+
100125
/** Run installation with full parameters, no need to ask questions
101126
*
102127
* It is expected to have all requirements installed

0 commit comments

Comments
 (0)