Skip to content

Commit 9ea8564

Browse files
committed
Initial Appveryor enablement
1 parent 467a5c6 commit 9ea8564

4 files changed

Lines changed: 132 additions & 4 deletions

File tree

appveyor.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
environment:
2+
matrix:
3+
- PYTHON: "C:\\Python27-x64"
4+
cassandra_version: 3.0.5
5+
ci_type: standard
6+
- PYTHON: "C:\\Python34"
7+
cassandra_version: 3.0.5
8+
ci_type: unit
9+
os: Visual Studio 2015
10+
platform:
11+
- x64
12+
install:
13+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
14+
- ps: .\appveyor\appveyor.ps1
15+
build_script:
16+
- cmd: |
17+
"%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" x86_amd64
18+
python setup.py install --no-cython
19+
test_script:
20+
- ps: .\appveyor\run_test.ps1
21+
cache:
22+
- C:\Users\appveyor\.m2
23+
- C:\ProgramData\chocolatey\bin
24+
- C:\ProgramData\chocolatey\lib
25+
- C:\Users\appveyor\jce_policy-1.7.0.zip
26+
- C:\Users\appveyor\jce_policy-1.8.0.zip

appveyor/appveyor.ps1

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
$env:JAVA_HOME="C:\Program Files\Java\jdk1.8.0"
2+
$env:PATH="$($env:JAVA_HOME)\bin;$($env:PATH)"
3+
$env:CCM_PATH="C:\Users\appveyor\ccm"
4+
$env:CASSANDRA_VERSION=$env:cassandra_version
5+
python --version
6+
python -c "import platform; print(platform.architecture())"
7+
# Install Ant
8+
Start-Process cinst -ArgumentList @("-y","ant") -Wait -NoNewWindow
9+
# Workaround for ccm, link ant.exe -> ant.bat
10+
If (!(Test-Path C:\ProgramData\chocolatey\bin\ant.bat)) {
11+
cmd /c mklink C:\ProgramData\chocolatey\bin\ant.bat C:\ProgramData\chocolatey\bin\ant.exe
12+
}
13+
14+
15+
$jce_indicator = "$target\README.txt"
16+
# Install Java Cryptographic Extensions, needed for SSL.
17+
If (!(Test-Path $jce_indicator)) {
18+
$zip = "C:\Users\appveyor\jce_policy-$($env:java_version).zip"
19+
$target = "$($env:JAVA_HOME)\jre\lib\security"
20+
# If this file doesn't exist we know JCE hasn't been installed.
21+
$url = "https://www.dropbox.com/s/po4308hlwulpvep/UnlimitedJCEPolicyJDK7.zip?dl=1"
22+
$extract_folder = "UnlimitedJCEPolicy"
23+
If ($env:java_version -eq "1.8.0") {
24+
$url = "https://www.dropbox.com/s/al1e6e92cjdv7m7/jce_policy-8.zip?dl=1"
25+
$extract_folder = "UnlimitedJCEPolicyJDK8"
26+
}
27+
# Download zip to staging area if it doesn't exist, we do this because
28+
# we extract it to the directory based on the platform and we want to cache
29+
# this file so it can apply to all platforms.
30+
if(!(Test-Path $zip)) {
31+
(new-object System.Net.WebClient).DownloadFile($url, $zip)
32+
}
33+
34+
Add-Type -AssemblyName System.IO.Compression.FileSystem
35+
[System.IO.Compression.ZipFile]::ExtractToDirectory($zip, $target)
36+
37+
$jcePolicyDir = "$target\$extract_folder"
38+
Move-Item $jcePolicyDir\* $target\ -force
39+
Remove-Item $jcePolicyDir
40+
}
41+
42+
# Install Python Dependencies for CCM.
43+
Start-Process python -ArgumentList "-m pip install psutil pyYaml six numpy" -Wait -NoNewWindow
44+
45+
# Clone ccm from git and use master.
46+
If (!(Test-Path $env:CCM_PATH)) {
47+
Start-Process git -ArgumentList "clone https://github.com/pcmanus/ccm.git $($env:CCM_PATH)" -Wait -NoNewWindow
48+
}
49+
50+
51+
# Copy ccm -> ccm.py so windows knows to run it.
52+
If (!(Test-Path $env:CCM_PATH\ccm.py)) {
53+
Copy-Item "$env:CCM_PATH\ccm" "$env:CCM_PATH\ccm.py"
54+
}
55+
56+
$env:PYTHONPATH="$($env:CCM_PATH);$($env:PYTHONPATH)"
57+
$env:PATH="$($env:CCM_PATH);$($env:PATH)"
58+
59+
# Predownload cassandra version for CCM if it isn't already downloaded.
60+
If (!(Test-Path C:\Users\appveyor\.ccm\repository\$env:cassandra_version)) {
61+
Start-Process python -ArgumentList "$($env:CCM_PATH)\ccm.py create -v $($env:cassandra_version) -n 1 predownload" -Wait -NoNewWindow
62+
Start-Process python -ArgumentList "$($env:CCM_PATH)\ccm.py remove predownload" -Wait -NoNewWindow
63+
}
64+
65+
Start-Process python -ArgumentList "-m pip install -r test-requirements.txt" -Wait -NoNewWindow
66+
Start-Process python -ArgumentList "-m pip install nose-ignore-docstring" -Wait -NoNewWindow

appveyor/run_test.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Set-ExecutionPolicy Unrestricted
2+
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -force
3+
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser -force
4+
Get-ExecutionPolicy -List
5+
echo $env:Path
6+
echo $env:JAVA_HOME
7+
echo $env:PYTHONPATH
8+
echo $env:CASSANDRA_VERSION
9+
echo $env:ci_type
10+
python --version
11+
python -c "import platform; print(platform.architecture())"
12+
13+
$wc = New-Object 'System.Net.WebClient'
14+
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=unit_results.xml .\tests\unit
15+
echo "uploading unit results"
16+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\unit_results.xml))
17+
18+
if($env:ci_type -eq 'standard' -Or $env:ci_type -eq 'long'){
19+
echo "Running CQLEngine integration tests"
20+
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=cqlengine_results.xml .\tests\integration\cqlengine
21+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\cqlengine_results.xml))
22+
echo "uploading CQLEngine test results"
23+
24+
echo "Running standard integration tests"
25+
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=standard_results.xml .\tests\integration\standard
26+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\standard_results.xml))
27+
echo "uploading standard integration test results"
28+
}
29+
30+
if($env:ci_type -eq 'long'){
31+
nosetests -s -v --with-ignore-docstrings --with-xunit --xunit-file=cqlengine_results.xml .\tests\integration\cqlengine
32+
$wc.UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\cqlengine_results.xml))
33+
echo "uploading standard integration test results"
34+
}
35+
exit 0

tests/unit/test_concurrent.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,11 @@ def insert_and_validate_list_generator(self, reverse, slowdown):
211211

212212
t = TimedCallableInvoker(our_handler, slowdown=slowdown)
213213
t.start()
214-
results = execute_concurrent(mock_session, statements_and_params, results_generator=True)
215-
216-
self.validate_result_ordering(results)
217-
t.stop()
214+
try:
215+
results = execute_concurrent(mock_session, statements_and_params, results_generator=True)
216+
self.validate_result_ordering(results)
217+
finally:
218+
t.stop()
218219

219220
def validate_result_ordering(self, results):
220221
"""

0 commit comments

Comments
 (0)