remove test.py.in

This commit is contained in:
Corentin Le Molgat
2022-09-30 14:24:58 +02:00
parent 02e6ba83fe
commit 40c87e6203
7 changed files with 41 additions and 64 deletions

View File

@@ -384,21 +384,11 @@ if(BUILD_TESTING)
COMMENT "Create venv and install ${PYTHON_PROJECT}"
VERBATIM)
add_custom_command(TARGET python_package POST_BUILD
DEPENDS python/test.py
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/test.py.in ${VENV_DIR}/test.py
BYPRODUCTS ${VENV_DIR}/test.py
WORKING_DIRECTORY python
COMMENT "Copying test.py"
VERBATIM)
configure_file(
${PROJECT_SOURCE_DIR}/ortools/init/python/version_test.py.in
${PROJECT_BINARY_DIR}/python/version_test.py
@ONLY)
# run the tests within the virtualenv
add_test(NAME pytest_venv
COMMAND ${VENV_Python3_EXECUTABLE} ${VENV_DIR}/test.py)
add_test(NAME python_init_version_test
COMMAND ${VENV_Python3_EXECUTABLE} ${PROJECT_BINARY_DIR}/python/version_test.py)
endif()

View File

@@ -89,7 +89,6 @@ Vagrant.configure("2") do |config|
config.vm.provision "file", source: "../../../../examples/tests", destination: "$HOME/project/examples/"
config.vm.provision "file", source: "../../../../patches", destination: "$HOME/project/"
config.vm.provision "file", source: "../../../../Version.txt", destination: "$HOME/project/"
config.vm.provision "file", source: "../../../../test.py.in", destination: "$HOME/project/"
config.vm.provision "file", source: "../../../../tools/README.pypi.txt", destination: "$HOME/project/tools/"
config.vm.provision "devel", type: "shell", inline:<<-SHELL

View File

@@ -562,7 +562,6 @@ package_python: python
test_package_python: package_python
-$(DELREC) $(PYPI_ARCHIVE_TEMP_DIR)$Svenv
$(PYTHON_EXECUTABLE) -m venv --system-site-packages $(PYPI_ARCHIVE_TEMP_DIR)$Svenv
$(COPY) test.py.in $(PYPI_ARCHIVE_TEMP_DIR)$Svenv$Stest.py
$(COPY) ortools$Salgorithms$Ssamples$Ssimple_knapsack_program.py $(PYPI_ARCHIVE_TEMP_DIR)$Svenv
$(COPY) ortools$Sgraph$Ssamples$Ssimple_max_flow_program.py $(PYPI_ARCHIVE_TEMP_DIR)$Svenv
$(COPY) ortools$Sgraph$Ssamples$Ssimple_min_cost_flow_program.py $(PYPI_ARCHIVE_TEMP_DIR)$Svenv

View File

@@ -1,40 +0,0 @@
import ortools
from ortools.linear_solver import pywraplp
from ortools.linear_solver import linear_solver_pb2
from ortools.constraint_solver import pywrapcp
from ortools.sat.python import swig_helper
from ortools.sat.python import cp_model
from ortools.graph.python import linear_sum_assignment
from ortools.graph.python import max_flow
from ortools.graph.python import min_cost_flow
from ortools.algorithms import pywrapknapsack_solver
from ortools.scheduling import pywraprcpsp
from ortools.util.python import sorted_interval_list
def lpsolver():
print('Test lpsolver...')
lpsolver = pywraplp.Solver(
'LinearTest',
pywraplp.Solver.GLOP_LINEAR_PROGRAMMING)
lpsolver.Solve()
print('Test lpsolver...DONE')
def cpsolver():
print('Test cpsolver...')
cpsolver = pywrapcp.Solver('ConstraintTest')
num_vals = 3
x = cpsolver.IntVar(0, num_vals - 1, "x")
y = cpsolver.IntVar(0, num_vals - 1, "y")
z = cpsolver.IntVar(0, num_vals - 1, "z")
cpsolver.Add(x != y)
db = cpsolver.Phase([x, y, z], cpsolver.CHOOSE_FIRST_UNBOUND, cpsolver.ASSIGN_MIN_VALUE)
cpsolver.Solve(db)
print('Test cpsolver...DONE')
def main():
print(ortools.__version__)
lpsolver()
cpsolver()
if __name__ == "__main__":
main()

View File

@@ -55,8 +55,7 @@ for i in "${PY[@]}"; do
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.sat import pywrapsat") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.graph import pywrapgraph") 2>&1 | tee -a test.log
(cd "${VENV_DIR}/bin" && ./python -c "from ortools.algorithms import pywrapknapsack_solver") 2>&1 | tee -a test.log
cp test.py.in "${VENV_DIR}/test.py"
"${VENV_DIR}/bin/python" "${VENV_DIR}/test.py" 2>&1 | tee -a test.log
"${VENV_DIR}/bin/python" "cmake/samples/python/sample.py" 2>&1 | tee -a test.log
echo "Testing ortools Python$i...DONE" | tee -a test.log
set -e
done

View File

@@ -51,7 +51,6 @@ echo Testing ortools Python3... | tee -a test.log
(cd ${VENV_DIR}/bin && ./python -c "from ortools.sat import pywrapsat") 2>&1 | tee -a test.log
(cd ${VENV_DIR}/bin && ./python -c "from ortools.graph import pywrapgraph") 2>&1 | tee -a test.log
(cd ${VENV_DIR}/bin && ./python -c "from ortools.algorithms import pywrapknapsack_solver") 2>&1 | tee -a test.log
cp test.py.in ${VENV_DIR}/test.py
${VENV_DIR}/bin/python ${VENV_DIR}/test.py 2>&1 | tee -a test.log
"${VENV_DIR}/bin/python" "cmake/samples/python/sample.py" 2>&1 | tee -a test.log
echo Testing ortools Python3...DONE | tee -a test.log
set -e

View File

@@ -19,6 +19,8 @@ which.exe C:\python38-64\python.exe || exit 1
echo C:\python38-64\python.exe: FOUND | tee.exe -a test.log
which.exe C:\python39-64\python.exe || exit 1
echo C:\python39-64\python.exe: FOUND | tee.exe -a test.log
which.exe C:\python310-64\python.exe || exit 1
echo C:\python310-64\python.exe: FOUND | tee.exe -a test.log
set LOCAL_PATH=%PATH%
@@ -50,8 +52,7 @@ FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO %TEMP_DIR%\venv\Scripts\python -m
echo Installing ortools Python3.6 venv...DONE | tee.exe -a test.log
echo Testing ortools Python3.6... | tee.exe -a test.log
copy test.py.in %TEMP_DIR%\venv\test.py
%TEMP_DIR%\venv\Scripts\python %TEMP_DIR%\venv\test.py 2>&1 | tee.exe -a test.log
%TEMP_DIR%\venv\Scripts\python cmake\samples\python\sample.py 2>&1 | tee.exe -a test.log
echo Testing ortools Python3.6...DONE | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
@@ -84,8 +85,7 @@ FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO %TEMP_DIR%\venv\Scripts\python -m
echo Installing ortools Python3.7 venv...DONE | tee.exe -a test.log
echo Testing ortools Python3.7... | tee.exe -a test.log
copy test.py.in %TEMP_DIR%\venv\test.py
%TEMP_DIR%\venv\Scripts\python %TEMP_DIR%\venv\test.py 2>&1 | tee.exe -a test.log
%TEMP_DIR%\venv\Scripts\python cmake\samples\python\sample.py 2>&1 | tee.exe -a test.log
echo Testing ortools Python3.7...DONE | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
@@ -118,8 +118,7 @@ FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO %TEMP_DIR%\venv\Scripts\python -m
echo Installing ortools Python3.8 venv...DONE | tee.exe -a test.log
echo Testing ortools Python3.8... | tee.exe -a test.log
copy test.py.in %TEMP_DIR%\venv\test.py
%TEMP_DIR%\venv\Scripts\python %TEMP_DIR%\venv\test.py 2>&1 | tee.exe -a test.log
%TEMP_DIR%\venv\Scripts\python cmake\samples\python\sample.py 2>&1 | tee.exe -a test.log
echo Testing ortools Python3.8...DONE | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
@@ -152,8 +151,40 @@ FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO %TEMP_DIR%\venv\Scripts\python -m
echo Installing ortools Python3.9 venv...DONE | tee.exe -a test.log
echo Testing ortools Python3.9... | tee.exe -a test.log
copy test.py.in %TEMP_DIR%\venv\test.py
%TEMP_DIR%\venv\Scripts\python %TEMP_DIR%\venv\test.py 2>&1 | tee.exe -a test.log
%TEMP_DIR%\venv\Scripts\python cmake\samples\python\sample.py 2>&1 | tee.exe -a test.log
echo Testing ortools Python3.9...DONE | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .
REM ###################
REM ## PYTHON 3.10 ##
REM ###################
echo Cleaning Python... | tee.exe -a test.log
make.exe clean_python WINDOWS_PATH_TO_PYTHON=c:\python310-64
echo Cleaning Python...DONE | tee.exe -a test.log
REM make.exe python WINDOWS_PATH_TO_PYTHON=c:\python310-64 || exit 1
REM echo make python3.10: DONE | tee.exe -a build.log
REM make.exe test_python WINDOWS_PATH_TO_PYTHON=c:\python310-64 || exit 1
REM echo make test_python3.10: DONE | tee.exe -a build.log
echo Rebuild Python3.10 pypi archive... | tee.exe -a test.log
make.exe package_python WINDOWS_PATH_TO_PYTHON=c:\python310-64 || exit 1
echo Rebuild Python3.10 pypi archive...DONE | tee.exe -a test.log
echo Creating Python3.10 venv... | tee.exe -a test.log
set PATH=c:\python310-64;c:\python310-64\Scripts;%PATH%
python -m pip install virtualenv
set TEMP_DIR=temp_python310
python -m virtualenv %TEMP_DIR%\venv
set PATH=%LOCAL_PATH%
echo Creating Python3.10 venv...DONE | tee.exe -a test.log
echo Installing ortools Python3.10 venv... | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO %TEMP_DIR%\venv\Scripts\python -m pip install %%i
echo Installing ortools Python3.10 venv...DONE | tee.exe -a test.log
echo Testing ortools Python3.10... | tee.exe -a test.log
%TEMP_DIR%\venv\Scripts\python cmake\samples\python\sample.py 2>&1 | tee.exe -a test.log
echo Testing ortools Python3.10...DONE | tee.exe -a test.log
FOR %%i IN (%TEMP_DIR%\ortools\dist\*.whl) DO copy %%i .