Merge lp:~brian.curtin/ubuntuone-client/run-tests-buildout-cleanup into lp:ubuntuone-client

Proposed by Brian Curtin on 2012-04-17
Status: Merged
Approved by: Manuel de la Peña on 2012-04-20
Approved revision: 1226
Merged at revision: 1227
Proposed branch: lp:~brian.curtin/ubuntuone-client/run-tests-buildout-cleanup
Merge into: lp:ubuntuone-client
Diff against target: 108 lines (+26/-53)
1 file modified
run-tests.bat (+26/-53)
To merge this branch: bzr merge lp:~brian.curtin/ubuntuone-client/run-tests-buildout-cleanup
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve on 2012-04-20
Diego Sarmentero (community) 2012-04-17 Approve on 2012-04-20
Review via email: mp+102394@code.launchpad.net

Commit message

- Make run-tests.bat work with the new buildout environment.

Description of the change

Allow run-tests.bat to work with the new buildout environment.

This depends on lp:~brian.curtin/ubuntuone-windows-installer/buildout-env

To post a comment you must log in.
1226. By Brian Curtin on 2012-04-18

Prefer the TRIAL_TEMP_DIR environment variable for Jenkins, and fall back to the local _trial_temp directory

Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve
Manuel de la Peña (mandel) wrote :

Same here, worked with no problems!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run-tests.bat'
2--- run-tests.bat 2012-04-09 20:07:05 +0000
3+++ run-tests.bat 2012-04-18 17:33:51 +0000
4@@ -27,58 +27,22 @@
5
6 @ECHO off
7
8-:: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
9-:: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
10-SET REGQUERY27="REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve"
11-SET REGQUERY2732="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve"
12-SET REGQUERY26="REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve"
13-SET REGQUERY2632="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve"
14 SET PYTHONEXEPATH=""
15
16-:: This is very annoying; FOR /F will work differently depending on the output
17-:: of reg which is not consistent between OS versions (XP, 7). We must choose
18-:: the tokens according to OS version.
19-SET PYTHONPATHTOKENS=3
20-VER | FIND "XP" > nul
21-IF %ERRORLEVEL% == 0 (
22- SET PYTHONPATHTOKENS=4)
23-
24-ECHO Checking if python 2.7 is in the system
25-
26-:: Look for python 2.7
27-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
28-
29-IF NOT %PYTHONEXEPATH% == "" (
30- GOTO :PYTHONPRESENT)
31-
32-ECHO Checking if python 2.6 is in the system
33-:: we do not have python 2.7 in the system, try to find 2.6
34-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
35-
36-IF NOT %PYTHONEXEPATH% == "" (
37- GOTO :PYTHONPRESENT)
38-
39-:: we do not have python (2.6 or 2.7) this could hapen in the case that the
40-:: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
41-
42-:: Look for python 2.7 in WoW64
43-ECHO Checking if python 2.7 32 is in the system
44-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
45-
46-IF NOT %PYTHONEXEPATH% == "" (
47- GOTO :PYTHONPRESENT)
48-
49-ECHO Checking if python 2.6 32 is in the system
50-:: we do not have python 2.7 in the system, try to find 2.6
51-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
52-
53-IF NOT %PYTHONEXEPATH% == "" (
54- GOTO :PYTHONPRESENT)
55+set PYTHONPATH=..\ubuntu-sso-client;.
56+
57+ECHO Checking for Python on the path
58+:: Look for Python from buildout
59+FOR %%A in (python.exe) do (SET PYTHONEXEPATH=%%~$PATH:A)
60+FOR %%B in (u1trial) do (SET TRIALPATH=%%~$PATH:B)
61+FOR %%C in (u1lint) do (SET LINTPATH=%%~$PATH:C)
62+FOR %%D in (pep8.exe) do (SET PEP8PATH=%%~$PATH:D)
63+
64+IF NOT "%PYTHONEXEPATH%" == "" GOTO :PYTHONPRESENT
65
66 ECHO Please ensure you have python installed
67 GOTO :END
68
69-
70 :PYTHONPRESENT
71
72 :: throw the first parameter away if is /skip-lint,
73@@ -110,19 +74,28 @@
74 COPY windows\clientdefs.py ubuntuone\clientdefs.py
75 COPY windows\logging.conf data\logging.conf
76 :: execute the tests with a number of ignored linux only modules
77-"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" --reactor=twisted -c -p tests\platform\linux %PARAMS% tests
78+"%PYTHONEXEPATH%" "%TRIALPATH%" --reactor=twisted -c -p tests\platform\linux %PARAMS% tests
79
80 IF %SKIPLINT% == 1 (
81 ECHO Skipping style checks
82 GOTO :CLEAN)
83-"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint"
84-:: test for style if we can, if pep8 is not present, move to the end
85-IF EXIST "%PYTHONEXEPATH%\Scripts\pep8.exe" (
86- "%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat ubuntuone
87+ECHO Performing style checks...
88+"%PYTHONEXEPATH%" "%LINTPATH%"
89+
90+:: if pep8 is not present, move to the end
91+IF EXIST "%PEP8PATH%" (
92+ "%PEP8PATH%" --repeat ubuntuone
93 )ELSE (
94 ECHO Style checks were not done)
95 :CLEAN
96+
97+:: The dot must be escaped or the directory won't be found.
98+IF EXIST \.coverage RMDIR /s /q \.coverage
99+
100 :: Delete the temp folders
101-RMDIR /s /q _trial_temp
102-RMDIR /s /q .coverage
103+IF "%TRIAL_TEMP_DIR%" == "" GOTO :TRIALTEMPEXISTS
104+IF EXIST _trial_temp RMDIR /s /q _trial_temp
105+: TRIALTEMPEXISTS
106+IF EXIST "%TRIAL_TEMP_DIR%" RMDIR /s /q "%TRIAL_TEMP_DIR%"
107+
108 :END

Subscribers

People subscribed via source and target branches