From e7f0c5891580f24f4b3dbe5cde1422f00633c8b2 Mon Sep 17 00:00:00 2001 From: Gabriel Braga Date: Wed, 16 Oct 2024 10:57:13 -0300 Subject: [PATCH] Update windows packager and tests for Python 3.12 This commit is a windows packager update inclusive of a recent Python version, a C++ Visual Studio executable needed by torch, and some test fixes so to run without errors in windows environments. Remove no longer needed change of directory and an echo off line that makes debugging of the packager script more difficult. --- packaging/packager_win.bat | 12 +++++++----- tests/test_controller.py | 1 + tests/test_fileresolver.py | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packaging/packager_win.bat b/packaging/packager_win.bat index 48026b31..a32e3b02 100644 --- a/packaging/packager_win.bat +++ b/packaging/packager_win.bat @@ -1,5 +1,3 @@ -@Echo off - SET DISTRO="windows" SET DISTRO_VERSION="10" SET DISTRO_ROOT="%HOMEDRIVE%" @@ -16,17 +14,21 @@ REM Requires VNC server and thus only available on Linux SET DISABLE_VNCDOTOOL=1 REM Main deps -cd %DISTRO_ROOT%\ REM Assuming a local python executable to avoid overloading the download web page -START /WAIT python-3.9.0-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 +START /WAIT python-3.12.6-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 REM set a temporary path variable valid inside this session -set PYTHONPATH="C:\Program Files\Python39" +set PYTHONPATH="C:\Program Files\Python312" set PATH=%PYTHONPATH%;%PYTHONPATH%\Scripts;%PATH% REM a permanent path variable will be set by the executable once this batch exits +REM Install the vc_redist for C++ silently +REM Assuming a local executable to avoid overloading the download web page +powershell -ExecutionPolicy Bypass -Command "Start-Process -FilePath 'C:\packages\vc_redist.x64.exe' -ArgumentList '/q' -Wait" + REM GuiBot deps pip install --user --upgrade pip pip install -r %DISTRO_ROOT%\guibot\packaging\pip_requirements.txt +pip install setuptools REM GuiBot setup echo Copying GuiBot files diff --git a/tests/test_controller.py b/tests/test_controller.py index 6f6e32f7..7798ed80 100755 --- a/tests/test_controller.py +++ b/tests/test_controller.py @@ -313,6 +313,7 @@ def test_mouse_scroll(self) -> None: self.child_app = None @unittest.skipIf(os.environ.get('DISABLE_PYQT', "0") == "1", "PyQt disabled") + @unittest.skipIf(os.name == 'nt', "Windows takes too long, test fails") def test_keys_press(self) -> None: """Check key press effect for all display controller backends.""" for display in self.backends: diff --git a/tests/test_fileresolver.py b/tests/test_fileresolver.py index 16e5141d..c911eef1 100644 --- a/tests/test_fileresolver.py +++ b/tests/test_fileresolver.py @@ -132,14 +132,15 @@ class CustomFileResolverTest(unittest.TestCase): def test_custom_paths(self) -> None: """Test if custom paths work correctly.""" + os_name = os.name # temporary directory 1 tmp_dir1 = mkdtemp() - fd_tmp_file1, tmp_file1 = mkstemp(prefix=tmp_dir1 + "/", suffix=".txt") + fd_tmp_file1, tmp_file1 = mkstemp(prefix=tmp_dir1 + ("/" if os_name != 'nt' else "\\"), suffix=".txt") os.close(fd_tmp_file1) # temporary directory 2 tmp_dir2 = mkdtemp() - fd_tmp_file2, tmp_file2 = mkstemp(prefix=tmp_dir2 + "/", suffix=".txt") + fd_tmp_file2, tmp_file2 = mkstemp(prefix=tmp_dir2 + ("/" if os_name != 'nt' else "\\"), suffix=".txt") os.close(fd_tmp_file2) filename1 = os.path.basename(tmp_file1)