Skip to content

Commit 28d67af

Browse files
committed
appveyor add MSYS2 test
1 parent 05345ac commit 28d67af

File tree

5 files changed

+89
-5
lines changed

5 files changed

+89
-5
lines changed

appveyor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@ environment:
4242
MYSQL_PATH: "C:\\Program Files\\MySQL\\MySQL Server 8.0"
4343
# the cache should always be saved, even on failure, to be available for the next run
4444
APPVEYOR_SAVE_CACHE_ON_ERROR: "true"
45+
TEST_MSYS2: "false"
4546

4647
matrix:
4748
# all the Python versions to be tested, both 32-bit and 64-bit
4849
# ref: https://www.appveyor.com/docs/windows-images-software/#python
50+
- PYTHON_HOME: "C:\\Python313-x64"
51+
CHERE_INVOKING: 1
52+
MSYSTEM: UCRT64
53+
# breaks $python_arch in install.ps1 but we don't need it here.
54+
PATH: C:\msys64\usr\bin;%PATH%
55+
TEST_MSYS2: "true"
4956
- PYTHON_HOME: "C:\\Python313-x64"
5057
- PYTHON_HOME: "C:\\Python313"
5158
- PYTHON_HOME: "C:\\Python312-x64"

appveyor/after_test.cmd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
IF "%TEST_MSYS2%" == "true" (
2+
ECHO *** MSYS2 - Skipping generation of the wheel file
3+
GOTO :end
4+
)
15
IF "%APVYR_GENERATE_WHEELS%" == "true" (
26
ECHO *** pip install build/wheel modules
37
"%PYTHON_HOME%\python" -m pip install build wheel --quiet --no-warn-script-location
@@ -7,8 +11,8 @@ IF "%APVYR_GENERATE_WHEELS%" == "true" (
711
ECHO.
812
ECHO *** \dist directory listing:
913
DIR /B dist
10-
ECHO.
1114
) ELSE (
1215
ECHO *** Skipping generation of the wheel file
13-
ECHO.
1416
)
17+
:end
18+
ECHO.

appveyor/build_script.cmd

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ ECHO APVYR_GENERATE_WHEELS : %APVYR_GENERATE_WHEELS%
1414
ECHO APVYR_VERBOSE : %APVYR_VERBOSE%
1515
ECHO.
1616
ECHO PYTHON_HOME : %PYTHON_HOME%
17+
ECHO TEST_MSYS2 : %TEST_MSYS2%
1718
ECHO MSSQL_INSTANCE: %MSSQL_INSTANCE%
1819
ECHO POSTGRES_PATH : %POSTGRES_PATH%
1920
ECHO MYSQL_PATH : %MYSQL_PATH%
2021

2122
ECHO.
23+
IF "%TEST_MSYS2%" == "true" GOTO :msys2
2224
ECHO *** Get build info and compiler for the current Python installation:
2325
"%PYTHON_HOME%\python" -c "import platform; print(platform.python_build(), platform.python_compiler())"
2426

@@ -51,4 +53,35 @@ ECHO.
5153
ECHO *** Get version of the built pyodbc module:
5254
"%PYTHON_HOME%\python" -c "import pyodbc; print(pyodbc.version)"
5355

56+
GOTO :end
57+
58+
:msys2
59+
ECHO *** Get build info and compiler for the current Python installation:
60+
bash -lc "python -c ""import platform; print(platform.python_build(), platform.python_compiler())"""
61+
62+
ECHO.
63+
bash -lc "python -m pip freeze --all"
64+
65+
ECHO.
66+
ECHO *** Installing pyodbc...
67+
SET PYTHON_ARGS=.
68+
IF "%APVYR_VERBOSE%" == "true" (
69+
SET PYTHON_ARGS=--verbose %PYTHON_ARGS%
70+
)
71+
SET PIP_BREAK_SYSTEM_PACKAGES=1
72+
bash -lc "python -m pip install %PYTHON_ARGS%"
73+
IF ERRORLEVEL 1 (
74+
ECHO *** ERROR: pyodbc install failed
75+
EXIT 1
76+
)
77+
78+
ECHO.
79+
ECHO *** pip freeze...
80+
bash -lc "python -m pip freeze --all"
81+
82+
ECHO.
83+
ECHO *** Get version of the built pyodbc module:
84+
bash -lc "python -c ""import pyodbc; print(pyodbc.version)"""
85+
86+
:end
5487
ECHO.

appveyor/install.cmd

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1-
ECHO *** pip install pytest and other dev requirements ***
2-
"%PYTHON_HOME%\python" -m pip install -r requirements-dev.txt --quiet --no-warn-script-location
1+
IF "%TEST_MSYS2%" == "true" (
2+
ECHO *** pacman install dev requirements ***
3+
bash -lc "pacman --noconfirm -Syuu"
4+
bash -lc "pacman --noconfirm -Syuu"
5+
bash -lc "pacman --noconfirm --needed -S - < ./appveyor/mingw_pkglist.txt"
6+
) ELSE (
7+
ECHO *** pip install pytest and other dev requirements ***
8+
"%PYTHON_HOME%\python" -m pip install -r requirements-dev.txt --quiet --no-warn-script-location
9+
)
310
ECHO.

appveyor/test_script.cmd

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ SET OVERALL_RESULT=0
44

55
REM Output a list of the ODBC drivers available to pyodbc
66
ECHO *** Available ODBC Drivers:
7-
"%PYTHON_HOME%\python" -c "import pyodbc; print('\n'.join(sorted(pyodbc.drivers())))"
7+
IF "%TEST_MSYS2%" == "true" (
8+
bash -lc "python -c ""import pyodbc; print('\n'.join(sorted(pyodbc.drivers())))"""
9+
) ELSE (
10+
"%PYTHON_HOME%\python" -c "import pyodbc; print('\n'.join(sorted(pyodbc.drivers())))"
11+
)
812

913

1014
REM check if any testing should be done at all
@@ -43,6 +47,14 @@ IF ERRORLEVEL 1 (
4347
)
4448

4549

50+
REM check if only msys2 tests
51+
IF "%TEST_MSYS2%" == "true" (
52+
ECHO.
53+
ECHO *** testing MSYS2
54+
GOTO :msys2
55+
)
56+
57+
4658
:mssql2
4759
REM Native Client 11.0 is so old, it might not be available on the server
4860
SET DRIVER={SQL Server Native Client 11.0}
@@ -216,6 +228,27 @@ IF "%APVYR_VERBOSE%" == "true" (
216228
%PYTHON_ARGS% "tests\mysql_test.py"
217229
IF ERRORLEVEL 1 SET OVERALL_RESULT=1
218230

231+
GOTO :end
232+
233+
:msys2
234+
SET DRIVER={ODBC Driver 17 for SQL Server}
235+
SET PYODBC_SQLSERVER=Driver=%DRIVER%;Server=%MSSQL_INSTANCE%;Database=test_db;UID=sa;PWD=Password12!;
236+
ECHO.
237+
ECHO *** Run tests using driver: "%DRIVER%"
238+
bash -lc "python appveyor/test_connect.py '%PYODBC_SQLSERVER%'"
239+
IF ERRORLEVEL 1 (
240+
ECHO *** ERROR: Could not connect using the connection string:
241+
ECHO "%PYODBC_SQLSERVER%"
242+
SET OVERALL_RESULT=1
243+
GOTO :end
244+
)
245+
SET PYTHON_ARGS=-m pytest
246+
IF "%APVYR_VERBOSE%" == "true" (
247+
SET PYTHON_ARGS=%PYTHON_ARGS% --verbose
248+
)
249+
bash -lc "python %PYTHON_ARGS% tests/sqlserver_test.py"
250+
IF ERRORLEVEL 1 SET OVERALL_RESULT=1
251+
219252

220253
:end
221254
ECHO.

0 commit comments

Comments
 (0)