Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bd260cc
Changes to support building with the VCForPython27 compiler.
wettenhj Mar 17, 2017
a9703ed
Adding pytest-cov to requirements for measuring test coverage
wettenhj Mar 17, 2017
293783c
Don't try to use a wx.PyTimer if there's no MainLoop to help with uni…
wettenhj Mar 17, 2017
604a69c
Check IsModal before calling EndModal, which is useful for unittests.
wettenhj Mar 17, 2017
e3fd038
Don't call PushEventHandler or PopEventHandler unless we have a MainL…
wettenhj Mar 17, 2017
418b0a4
Needs Review. Workaround for UnboundLocalError.
wettenhj Mar 17, 2017
b158331
The type of long integers is now 'int' (PEP 237).
wettenhj Mar 17, 2017
0d24828
Workaround for "R6025 - pure virtual function call"
wettenhj Mar 17, 2017
ff87c64
Replacing deprecated LoadFromString with LoadFromBuffer
wettenhj Mar 17, 2017
d5a55b4
Fixing "TypeError: 'int' does not have the buffer interface"
wettenhj Mar 17, 2017
492ba1f
Skipping this test for now because of Buffer Overflow Exceptions
wettenhj Mar 17, 2017
c0798f4
Surely skipIt should be True if import fails?
wettenhj Mar 17, 2017
67b5453
Replacing deprecated assertion methods
wettenhj Mar 17, 2017
5a7b80a
Ensure that modal dialog is dismissed so test doesn't hang
wettenhj Mar 17, 2017
853c9d4
wxTipWindow should be shown automatically after it's instantiated.
wettenhj Mar 17, 2017
34351fa
Don't use wx.CallAfter within unit test (without MainLoop).
wettenhj Mar 17, 2017
7db6143
Removed line which causes AppCrash (Win7, Python2.7)
wettenhj Mar 17, 2017
fe6f621
Reverting https://github.com/wettenhj/Phoenix/commit/34351fa5c202f67e…
wettenhj Mar 18, 2017
903af3d
Workarounds from some issues with tests, primarily addressing situations
wettenhj Mar 18, 2017
a0d4c71
Ensuring that self hasn't been destroyed before running method invoked
wettenhj Mar 18, 2017
6c48b5c
Added warning that test could hang without network connectivity.
wettenhj Mar 18, 2017
1c66eff
Calling DestroyChildren earlier than it would normally be called in
wettenhj Mar 19, 2017
829e820
Adding .appveyor.yml to test Windows builds.
wettenhj Mar 19, 2017
6cb607a
Updating CI config
wettenhj Mar 19, 2017
3add0bd
Using short version of pytest's --capture=no option and avoiding quotes
wettenhj Mar 19, 2017
c75c45c
Fixing path to AppVeyor helper files
wettenhj Mar 19, 2017
80d12bc
Avoiding PyNoAppError during tearDown.
wettenhj Mar 19, 2017
dc48820
Adding test coverage
wettenhj Mar 19, 2017
90f54c1
Avoiding PyNoAppError in tearDown. This is what I meant to do in htt…
wettenhj Mar 19, 2017
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
48 changes: 48 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Samuel Dunn
# Modified by James Wettenhall
# Appveyor configuration file for Phoenix

environment:
global:
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
# /E:ON and /V:ON options are not enabled in the batch script intepreter
# See: http://stackoverflow.com/a/13751649/163740
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\.appveyor\\run_with_env.cmd"

matrix:

- PYTHON: "C:\\Python27.13"
PYTHON_VERSION: "2.7.13"
PYTHON_ARCH: "32"

install:
- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""

# Install Python (from the official .msi of http://python.org) and pip when
# not already installed.
- ps: if (-not(Test-Path($env:PYTHON))) { & .appveyor\install.ps1 }

# Prepend newly installed Python to the PATH of this build (this cannot be
# done from inside the powershell script as it would require to restart
# the parent CMD process).
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"

# Check that we have the expected version and architecture for Python:
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""

# Upgrade to the latest version of pip:
- "pip install --disable-pip-version-check --user --upgrade pip"

- "pip install -U -r requirements.txt"

# Install wxWidgets submodule:
- "git submodule init"
- "git submodule update"

build: false # Not a C# project, build stuff at the test step instead.

test_script:
- "%CMD_IN_ENV% python build.py dox etg --nodoc sip build"
- "%CMD_IN_ENV% python build.py test --extra_pytest=\"-s --cov=wx\""
223 changes: 223 additions & 0 deletions .appveyor/install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
# Sample script to install Python and pip under Windows
# Authors: Olivier Grisel, Jonathan Helmus, Kyle Kastner, and Alex Willmer
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/

$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
$BASE_URL = "https://www.python.org/ftp/python/"
$GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
$GET_PIP_PATH = "C:\get-pip.py"

$PYTHON_PRERELEASE_REGEX = @"
(?x)
(?<major>\d+)
\.
(?<minor>\d+)
\.
(?<micro>\d+)
(?<prerelease>[a-z]{1,2}\d+)
"@


function Download ($filename, $url) {
$webclient = New-Object System.Net.WebClient

$basedir = $pwd.Path + "\"
$filepath = $basedir + $filename
if (Test-Path $filename) {
Write-Host "Reusing" $filepath
return $filepath
}

# Download and retry up to 3 times in case of network transient errors.
Write-Host "Downloading" $filename "from" $url
$retry_attempts = 2
for($i=0; $i -lt $retry_attempts; $i++){
try {
$webclient.DownloadFile($url, $filepath)
break
}
Catch [Exception]{
Start-Sleep 1
}
}
if (Test-Path $filepath) {
Write-Host "File saved at" $filepath
} else {
# Retry once to get the error message if any at the last try
$webclient.DownloadFile($url, $filepath)
}
return $filepath
}


function ParsePythonVersion ($python_version) {
if ($python_version -match $PYTHON_PRERELEASE_REGEX) {
return ([int]$matches.major, [int]$matches.minor, [int]$matches.micro,
$matches.prerelease)
}
$version_obj = [version]$python_version
return ($version_obj.major, $version_obj.minor, $version_obj.build, "")
}


function DownloadPython ($python_version, $platform_suffix) {
$major, $minor, $micro, $prerelease = ParsePythonVersion $python_version

if (($major -le 2 -and $micro -eq 0) `
-or ($major -eq 3 -and $minor -le 2 -and $micro -eq 0) `
) {
$dir = "$major.$minor"
$python_version = "$major.$minor$prerelease"
} else {
$dir = "$major.$minor.$micro"
}

if ($prerelease) {
if (($major -le 2) `
-or ($major -eq 3 -and $minor -eq 1) `
-or ($major -eq 3 -and $minor -eq 2) `
-or ($major -eq 3 -and $minor -eq 3) `
) {
$dir = "$dir/prev"
}
}

if (($major -le 2) -or ($major -le 3 -and $minor -le 4)) {
$ext = "msi"
} else {
$ext = "exe"
}

$filename = "python-$python_version$platform_suffix.$ext"
$url = "$BASE_URL/$dir/$filename"
$filepath = Download $filename $url
return $filepath
}


function InstallPython ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -eq "32") {
$platform_suffix = ""
} else {
$platform_suffix = ".amd64"
}
$installer_path = DownloadPython $python_version $platform_suffix
$installer_ext = [System.IO.Path]::GetExtension($installer_path)
Write-Host "Installing $installer_path to $python_home"
$install_log = $python_home + ".log"
if ($installer_ext -eq '.msi') {
InstallPythonMSI $installer_path $python_home $install_log
} else {
InstallPythonEXE $installer_path $python_home $install_log
}
if (Test-Path $python_home) {
Write-Host "Python $python_version ($architecture) installation complete"
} else {
Write-Host "Failed to install Python in $python_home"
Get-Content -Path $install_log
Exit 1
}
}


function InstallPythonEXE ($exepath, $python_home, $install_log) {
$install_args = "/quiet InstallAllUsers=1 TargetDir=$python_home"
RunCommand $exepath $install_args
}


function InstallPythonMSI ($msipath, $python_home, $install_log) {
$install_args = "/qn /log $install_log /i $msipath TARGETDIR=$python_home"
$uninstall_args = "/qn /x $msipath"
RunCommand "msiexec.exe" $install_args
if (-not(Test-Path $python_home)) {
Write-Host "Python seems to be installed else-where, reinstalling."
RunCommand "msiexec.exe" $uninstall_args
RunCommand "msiexec.exe" $install_args
}
}

function RunCommand ($command, $command_args) {
Write-Host $command $command_args
Start-Process -FilePath $command -ArgumentList $command_args -Wait -Passthru
}


function InstallPip ($python_home) {
$pip_path = $python_home + "\Scripts\pip.exe"
$python_path = $python_home + "\python.exe"
if (-not(Test-Path $pip_path)) {
Write-Host "Installing pip..."
$webclient = New-Object System.Net.WebClient
$webclient.DownloadFile($GET_PIP_URL, $GET_PIP_PATH)
Write-Host "Executing:" $python_path $GET_PIP_PATH
Start-Process -FilePath "$python_path" -ArgumentList "$GET_PIP_PATH" -Wait -Passthru
} else {
Write-Host "pip already installed."
}
}


function DownloadMiniconda ($python_version, $platform_suffix) {
if ($python_version -eq "3.4") {
$filename = "Miniconda3-3.5.5-Windows-" + $platform_suffix + ".exe"
} else {
$filename = "Miniconda-3.5.5-Windows-" + $platform_suffix + ".exe"
}
$url = $MINICONDA_URL + $filename
$filepath = Download $filename $url
return $filepath
}


function InstallMiniconda ($python_version, $architecture, $python_home) {
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
if (Test-Path $python_home) {
Write-Host $python_home "already exists, skipping."
return $false
}
if ($architecture -eq "32") {
$platform_suffix = "x86"
} else {
$platform_suffix = "x86_64"
}
$filepath = DownloadMiniconda $python_version $platform_suffix
Write-Host "Installing" $filepath "to" $python_home
$install_log = $python_home + ".log"
$args = "/S /D=$python_home"
Write-Host $filepath $args
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
if (Test-Path $python_home) {
Write-Host "Python $python_version ($architecture) installation complete"
} else {
Write-Host "Failed to install Python in $python_home"
Get-Content -Path $install_log
Exit 1
}
}


function InstallMinicondaPip ($python_home) {
$pip_path = $python_home + "\Scripts\pip.exe"
$conda_path = $python_home + "\Scripts\conda.exe"
if (-not(Test-Path $pip_path)) {
Write-Host "Installing pip..."
$args = "install --yes pip"
Write-Host $conda_path $args
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
} else {
Write-Host "pip already installed."
}
}

function main () {
InstallPython $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
InstallPip $env:PYTHON
}

main
47 changes: 47 additions & 0 deletions .appveyor/run_with_env.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
:: To build extensions for 64 bit Python 3, we need to configure environment
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
::
:: To build extensions for 64 bit Python 2, we need to configure environment
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
::
:: 32 bit builds do not require specific environment configurations.
::
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
:: cmd interpreter, at least for (SDK v7.0)
::
:: More details at:
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
:: http://stackoverflow.com/a/13751649/163740
::
:: Author: Olivier Grisel
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
@ECHO OFF

SET COMMAND_TO_RUN=%*
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows

SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
IF %MAJOR_PYTHON_VERSION% == "2" (
SET WINDOWS_SDK_VERSION="v7.0"
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
SET WINDOWS_SDK_VERSION="v7.1"
) ELSE (
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
EXIT 1
)

IF "%PYTHON_ARCH%"=="64" (
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
SET DISTUTILS_USE_SDK=1
SET MSSdk=1
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
) ELSE (
ECHO Using default MSVC build environment for 32 bit architecture
ECHO Executing: %COMMAND_TO_RUN%
call %COMMAND_TO_RUN% || EXIT 1
)
4 changes: 4 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,9 @@ def checkCompiler(quiet=False):
# Make sure that the compiler that Python wants to use can be found.
# It will terminate if the compiler is not found or other exceptions
# are raised.
# setuptools is imported to address https://bugs.python.org/issue23246
cmd = "import distutils.msvc9compiler as msvc; " \
"import setuptools; " \
"mc = msvc.MSVCCompiler(); " \
"mc.initialize(); " \
"print(mc.cc)"
Expand All @@ -734,7 +736,9 @@ def checkCompiler(quiet=False):
# Now get the environment variables which that compiler needs from
# its vcvarsall.bat command and load them into this process's
# environment.
# setuptools is imported to address https://bugs.python.org/issue23246
cmd = "import distutils.msvc9compiler as msvc; " \
"import setuptools; " \
"arch = msvc.PLAT_TO_VCVARS[msvc.get_platform()]; " \
"env = msvc.query_vcvarsall(msvc.VERSION, arch); " \
"print(env)"
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ twine
sphinx
requests
pytest
pytest-cov
pytest-xdist
pytest-timeout
numpy
5 changes: 1 addition & 4 deletions unittests/test_dataview.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ def test_dataviewItem6(self):

def test_dataviewItem7(self):
n = sys.maxsize
if six.PY3:
assert type(n) is int
else:
assert type(n) is long
assert type(n) is int
dvi = dv.DataViewItem(n)
self.assertTrue(dvi)
self.assertTrue(int(dvi.GetID()) == n)
Expand Down
8 changes: 8 additions & 0 deletions unittests/test_datectrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ def test_datectrl2(self):
def test_genericdatectrl1(self):
dp = wx.adv.GenericDatePickerCtrl(self.frame, dt=wx.DateTime.Now())

# Explicitly calling Destroy seems to be necessary to avoid
# R6025 - pure virtual function call
dp.Destroy()

def test_genericdatectrl2(self):
dp = wx.adv.GenericDatePickerCtrl()
dp.Create(self.frame, dt=wx.DateTime.Now())

# Explicitly calling Destroy seems to be necessary to avoid
# R6025 - pure virtual function call
dp.Destroy()


#---------------------------------------------------------------------------

Expand Down
Loading