Skip to content

Commit f634368

Browse files
author
Thierry RAMORASOAVINA
committed
Update the integration test for windows
1 parent a7f77cc commit f634368

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/tests.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,21 @@ jobs:
276276
python -m pip install setuptools
277277
python scripts/extract_dependencies_from_pyproject_toml.py -f "pyproject.toml" -s "\n" > requires.txt
278278
279-
# Install the Python requirements
279+
# Install the Python requirements outside a python venv
280280
Get-Content .\requires.txt `
281281
| ForEach-Object {python -m pip install $_.toString()}
282+
283+
# Create and activate a python venv
284+
python -m venv khiops-windows-venv
285+
khiops-windows-venv\Scripts\Activate.ps1
286+
287+
# Install the Python requirements inside a venv
288+
# The venv python executable is used here
289+
Get-Content .\requires.txt `
290+
| ForEach-Object {khiops-windows-venv\Scripts\python -m pip install $_.toString()}
291+
292+
# Deactivate the python venv
293+
deactivate
282294
Remove-Item -force requires.txt
283295
- name: Setup and Install Test Requirements
284296
run: python -m pip install -r test-requirements.txt
@@ -313,7 +325,7 @@ jobs:
313325
# because the library was not installed properly (the source code was only cloned)
314326
if ($LASTEXITCODE -ne 0) {
315327
Write-Host "::error::Status error: improper setup, as expected: khiops-python has been cloned, not installed from a package"
316-
}
328+
}
317329
318330
# Run integration tests on Windows
319331
Invoke-Expression -Command "$Python -m unittest -v tests.test_khiops_integrations"
@@ -323,6 +335,28 @@ jobs:
323335
324336
# Execute Khiops Coclustering sample (train and deploy model)
325337
Invoke-Expression -Command "$Python -m khiops.samples.samples -i deploy_coclustering -e"
338+
339+
# Install khiops-python in the python venv using the sources
340+
Invoke-Expression -Command "khiops-windows-venv\Scripts\Activate.ps1"
341+
# The venv python executable is used here
342+
Invoke-Expression -Command "khiops-windows-venv\Scripts\python -m pip install ."
343+
# Change directory to avoid using the cloned khiops-python
344+
Invoke-Expression -Command "cd khiops-windows-venv\"
345+
346+
# Print status
347+
# The venv python executable is used here
348+
Invoke-Expression -Command "Scripts\python -c 'import sys; import khiops.core as kh; return_code = kh.get_runner().print_status(); sys.exit(return_code)'"
349+
# The installation status MUST not fail
350+
if ($LASTEXITCODE -ne 0) {
351+
Write-Host "::error::Status error: khiops-python installation status check MUST NOT fail"
352+
353+
# Deactivate the python venv
354+
Invoke-Expression -Command "deactivate"
355+
exit 1
356+
}
357+
358+
# Deactivate the python venv
359+
Invoke-Expression -Command "deactivate"
326360
check-khiops-integration-on-linux:
327361
strategy:
328362
fail-fast: false

0 commit comments

Comments
 (0)