Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ci/install.ps1 and other ci configs for Windows #1345

Open
wants to merge 5 commits into
base: atspi
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,46 +16,55 @@ environment:
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "32"
UIA_SUPPORT: "NO"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

- PYTHON: "C:\\Python27-x64"
PYTHON_VERSION: "2.7"
PYTHON_ARCH: "64"
UIA_SUPPORT: "YES"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

- PYTHON: "C:\\Python35"
PYTHON_VERSION: "3.5"
PYTHON_ARCH: "32"
UIA_SUPPORT: "YES"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

- PYTHON: "C:\\Python37"
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "32"
UIA_SUPPORT: "NO"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

- PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: "3.7"
PYTHON_ARCH: "64"
UIA_SUPPORT: "YES"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

- PYTHON: "C:\\Python38-x64"
PYTHON_VERSION: "3.8"
PYTHON_ARCH: "64"
UIA_SUPPORT: "YES"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015

- PYTHON: "C:\\Python39"
PYTHON_VERSION: "3.9"
PYTHON_ARCH: "32"
UIA_SUPPORT: "YES"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022

- PYTHON: "C:\\Python310-x64"
PYTHON_VERSION: "3.10"
PYTHON_ARCH: "64"
UIA_SUPPORT: "YES"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022

- PYTHON: "C:\\Python311-x64"
PYTHON_VERSION: "3.11"
PYTHON_ARCH: "64"
UIA_SUPPORT: "YES"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022

#init:
# Enable RDP.
Expand All @@ -77,7 +86,9 @@ install:
# compiled extensions and are not provided as pre-built wheel packages,
# pip will build them from source using the MSVC compiler matching the
# target Python version and architecture
- "%PYTHON%\\python.exe -m pip install --upgrade pip"
- "%CMD_IN_ENV% pip install -r dev-requirements.txt"
- "%CMD_IN_ENV% python -c \"import os,subprocess; os.environ.get('UIA_SUPPORT')=='YES' and subprocess.check_output(['pip','install','comtypes'])\""

# Enable desktop (for correct screenshots).
#- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1'))
Expand Down
17 changes: 1 addition & 16 deletions ci/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,6 @@ function UpdateConda ($python_home) {
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
}

function InstallComtypes ($python_home) {
$pip_path = $python_home + "\Scripts\pip.exe"
$args = "install comtypes"
Start-Process -FilePath "$pip_path" -ArgumentList $args -Wait -Passthru
}

function main () {
try {
$CurrentResolution = Get-DisplayResolution
Expand All @@ -99,20 +93,11 @@ function main () {
Write-Host "Can't print current resolution. Get-DisplayResolution cmd is not available"
}

# fallback for running the script locally
if ( !(Test-Path $env:PYTHON) ) {
Write-Host "No PYTHON vars, setup default values"
$env:PYTHON="C:\\Python34-x64"
$env:PYTHON_VERSION="3.4"
$env:PYTHON_ARCH="64"
}
Write-Host "PYTHON=" $env:PYTHON
Write-Host "PYTHON_VERSION=" $env:PYTHON_VERSION
Write-Host "PYTHON_ARCH=" $env:PYTHON_ARCH
Write-Host "UIA_SUPPORT=" $env:UIA_SUPPORT

if ($env:UIA_SUPPORT -eq "YES") {
InstallComtypes $env:PYTHON
}
#InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
#UpdateConda $env:PYTHON
#InstallCondaPackages $env:PYTHON "pywin32 Pillow coverage nose"
Expand Down
13 changes: 12 additions & 1 deletion ci/runTestsuite.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,20 @@ function run {
$input = "nosetests.xml"
$output = "transformed.xml"

# Show file extensions
Set-ItemProperty -LiteralPath "HKCU:Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value "0" -Force
Stop-Process -Name Explorer -Force
Start-Sleep -Seconds 10

#nosetests --all-modules --with-xunit pywinauto/unittests
# --traverse-namespace is required for python 3.8 https://stackoverflow.com/q/58556183
nosetests --nologcapture --traverse-namespace --exclude=testall --with-xunit --with-coverage --cover-html --cover-html-dir=Coverage_report --cover-package=pywinauto --verbosity=3 pywinauto\unittests
$pyver = [System.Version]::new($env:PYTHON_VERSION)
if ($pyver.Major -gt 3 -or ($pyver.Major -eq 3 -and $pyver.Minor -ge 9)) {
coverage run --source=pywinauto -m nose2 --exclude=testall -vvv pywinauto.unittests
coverage xml -o $input
} else {
nosetests --nologcapture --traverse-namespace --exclude=testall --with-xunit --with-coverage --cover-html --cover-html-dir=Coverage_report --cover-package=pywinauto --verbosity=3 pywinauto\unittests
}
$success = $?
Write-Host "result code of nosetests:" $success

Expand Down
9 changes: 6 additions & 3 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
pywin32==301 ; python_version == '3.6' and sys_platform == "win32"
pywin32 ; python_version != '3.6' and sys_platform == "win32"
six
pillow>=6.2.0
pillow>=6.2.0 ; python_version != '3.9'
pillow==9.5.0 ; python_version == '3.9'
coverage
nose
nose ; python_version <= '3.8'
nose2 ; python_version >= '3.9'
codecov
rst2pdf
Sphinx
mock==2.0.0
codacy-coverage
PyQt5==5.15.4 ; python_version >= '3.6'
PyQt5==5.15.4 ; python_version >= '3.6' and python_version <= '3.8'
PyQt5 ; python_version >= '3.9'
Loading