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

Add support for Python 3.12 #72

Open
wants to merge 13 commits into
base: master
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
84 changes: 62 additions & 22 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ environment:
PYTHON_VERSION: 3.11
PYTHON_ARCH: 32

- job_name: Python 3.12 x86
PYTHON: "C:\\Python312"
PYTHON_VERSION: 3.12
PYTHON_ARCH: 32

- job_name: Python 3.7 x64
PYTHON: "C:\\Python37-x64"
PYTHON_VERSION: 3.7
Expand All @@ -55,21 +60,49 @@ environment:
PYTHON_VERSION: 3.11
PYTHON_ARCH: 64

- job_name: Python 3.12 x64
PYTHON: "C:\\Python312"
PYTHON_VERSION: 3.12
PYTHON_ARCH: 64

init:
- ECHO %PYTHON% %PYTHON_VERSION% %PYTHON_ARCH%
install:
- cmd: >-
set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%

python --version
- cmd: >-
set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%
python --version

before_build:
- cmd: git clone https://github.com/FlaUI/FlaUI.git C:\projects\FlaUI
- cmd: git clone https://github.com/FlaUI/FlaUI.git C:\projects\FlaUI

# PowerShell script to find and select the desired .NET SDK version
- ps: |
$dotnetVersions = dotnet --list-sdks
$desiredVersions = $dotnetVersions | Where-Object { $_ -match "6\." -or $_ -match "7\." }
$desiredVersion = ($desiredVersions | Sort-Object -Descending | Select-Object -First 1).Trim()
Write-Output "Selected .NET SDK version: $desiredVersion"

# Extract only the version number
$desiredVersionNumber = ($desiredVersion -split '[\[\]]')[0].Trim()
Write-Output "Extracted version number: $desiredVersionNumber"

# Create or update global.json with the selected SDK version
$globalJsonContent = @{
sdk = @{
version = $desiredVersionNumber
rollForward = "latestFeature"
}
} | ConvertTo-Json -Compress

Set-Content -Path "C:\projects\FlaUI\global.json" -Value $globalJsonContent

build_script:
- ps: |
# Run PowerShell script
& "C:\\projects\\FlaUI\\build.ps1"
cd "C:\projects\FlaUI"
dotnet --version

- ps: |
& "C:\\projects\\FlaUI\\build.ps1" --target "Build"

after_build:
- ps: |
Expand All @@ -79,11 +112,16 @@ after_build:
Copy-Item -Path "C:\projects\FlaUI\src\TestApplications\WinFormsApplication\bin\*" -Destination "C:\projects\flaui-uiautomation-wrapper\test_applications\WinFormsApplication" -Recurse -Force

before_test:
- cmd: cd "C:\projects\flaui-uiautomation-wrapper" && python -m pip install --upgrade pip && python -m pip install -r requirements.txt && python -m pip install -r requirements-unit-test.txt
- ps: |
cd "C:\projects\flaui-uiautomation-wrapper"
python -m pip install --upgrade pip
python -m pip install -r requirements.txt -r requirements-unit-test.txt
pip list

test_script:
- cmd: >-
cd "C:\projects\flaui-uiautomation-wrapper" && python -m pytest --cov=flaui --cov-report=xml --cov-report=html --cov-report=term-missing --junitxml=test-results.xml
- ps: |
ls
python -m pytest --cov=flaui --cov-report=xml --cov-report=html --cov-report=term-missing --junitxml=test-results.xml -vv

artifacts:
- path: test-results.xml
Expand All @@ -98,18 +136,20 @@ artifacts:
- path: test_applications
name: test-applications

on_finish:
- ps: >-
$wc = New-Object 'System.Net.WebClient'
cache:
- C:\Users\appveyor\.nuget\packages # Cache the NuGet packages
- C:\projects\FlaUI\**\bin
- C:\projects\FlaUI\**\obj
- C:\projects\FlaUI\src\TestApplications

if (Test-Path .test-results.xml) {
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .test-results.xml))
}
on_finish:
- ps: >-
$wc = New-Object 'System.Net.WebClient'

if (Test-Path .coverage.xml) {
$wc.UploadFile("https://ci.appveyor.com/api/testresults/coverage/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .coverage.xml))
}
if (Test-Path .\test-results.xml) {
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test-results.xml))
}

if (Test-Path "C:/projects/FlaUI/artifacts/UnitTestResult.xml") {
$wc.UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", "C:/projects/FlaUI/artifacts/UnitTestResult.xml")
}
if (Test-Path .\coverage.xml) {
$wc.UploadFile("https://ci.appveyor.com/api/testresults/coverage/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\coverage.xml))
}
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"[python]": {
"editor.defaultFormatter": null,
"editor.codeActionsOnSave": {
"source.fixAll": false
"source.fixAll": "never"
}
},
"ruff.importStrategy": "useBundled"
Expand Down
60 changes: 43 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ classifiers = [
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Quality Assurance",
Expand All @@ -47,36 +49,59 @@ classifiers = [
"Topic :: Software Development :: Testing",
"Intended Audience :: Developers",
]

[tool.poetry-git-version-plugin]
make_alpha_version = true
alpha_version_format = '{version}a{distance}+{commit_hash}'
version_format = '{version}'

[tool.poetry.dependencies]
python = ">=3.7,<3.12"
loguru = "^0.6.0"
pillow = "^9.3.0"
arrow = "^1.2.3"
pythonnet = "^3.0.1"
pydantic = "^2.0.0"
pydantic-settings = "^2.0.0"
pydantic-extra-types = "^2.0.0"
python = ">=3.7,<3.13"
loguru = "^0.7.2"
pillow = [
{ version = "^10.3.0", python = ">=3.8" },
{ version = "^9.3.0", python = "<3.8" },
]
arrow = [
{ version = "^1.3.0", python = ">=3.8" },
{ version = "^1.2.3", python = "<3.8" },
]
pythonnet = "^3.0.3"
pydantic = [
{ version = "^2.7.3", python = ">=3.8" },
{ version = "^2.0.0", python = "<3.8" },
]
pydantic-settings = [
{ version = "^2.3.1", python = ">=3.8" },
{ version = "^2.0.0", python = "<3.8" },
]
pydantic-extra-types = [
{ version = "^2.8.0", python = ">=3.8" },
{ version = "^2.0.0", python = "<3.8" },
]

[tool.poetry.group.dev.dependencies]
mypy = "^0.991"
mypy = [
{ version = "^1.10.0", python = ">=3.8" },
{ version = "^0.991", python = "<3.8" },
]
jupyter = "^1.0.0"
isort = "^5.10.1"
pre-commit = { version = "^3.3.3", python = ">=3.8" }
interrogate = "^1.5.0"
ruff = "^0.0.288"
interrogate = [
{ version = "^1.7.0", python = ">=3.8" },
{ version = "^1.5.0", python = "<3.8" },
]
ruff = "^0.4.8"

[tool.poetry.group.dev]
optional = true

[tool.poetry.group.unit_test.dependencies]
pytest = "^7.2.0"
pytest = [
{ version = "^8.2.2", python = ">=3.8" },
{ version = "^7.2.0", python = "<3.8" },
]
pytest-cov = "^4.0.0"
psutil = "^6.0.0"

[tool.poetry.group.unit_test]
optional = true
Expand All @@ -89,12 +114,15 @@ mkdocs-jupyter = "^0.24.1"
[tool.poetry.group.docs]
optional = true

[tool.poetry.group.unit_tests.dependencies]
pytest-sugar = "^1.0.0"

[build-system]
requires = ["poetry-core>=1.0.0", "setuptools", "wheel"]
build-backend = "poetry.core.masonry.api"

[tool.pytest.ini_options]
minversion = "6.0"
minversion = "7.0"
addopts = "-ra -q -p no:warnings --junitxml=test-results.xml"
testpaths = ["tests/unit_tests/"]

Expand Down Expand Up @@ -137,7 +165,6 @@ py_version = 310
[tool.black]
# https://github.com/psf/black
line-length = 120
target_version = ['py310']
exclude = '''
(
/(
Expand All @@ -157,7 +184,6 @@ plugins = ["pydantic.mypy"]

follow_imports = "skip"
warn_redundant_casts = true
swarn_unused_ignores = true
no_implicit_reexport = true

[tool.pydantic-mypy]
Expand Down
Loading
Loading