Merge lp:~brian.curtin/ubuntuone-dev-tools/runtests-update-for-buildout into lp:ubuntuone-dev-tools

Proposed by Brian Curtin
Status: Merged
Approved by: dobey
Approved revision: 67
Merged at revision: 69
Proposed branch: lp:~brian.curtin/ubuntuone-dev-tools/runtests-update-for-buildout
Merge into: lp:ubuntuone-dev-tools
Diff against target: 107 lines (+21/-57)
1 file modified
run-tests.bat (+21/-57)
To merge this branch: bzr merge lp:~brian.curtin/ubuntuone-dev-tools/runtests-update-for-buildout
Reviewer Review Type Date Requested Status
dobey (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+103459@code.launchpad.net

Commit message

- Update the run-tests.bat script to work with a buildout-based setup.

Description of the change

Update the run-tests.bat script to work with a buildout-based setup.

To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve
Revision history for this message
dobey (dobey) :
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-20 11:37:33 +0000
3+++ run-tests.bat 2012-04-25 12:40:24 +0000
4@@ -28,59 +28,18 @@
5 :: files in the program, then also delete it here.
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-::
20-SET PYTHONPATHTOKENS=3
21-VER | FIND "XP" > nul
22-IF %ERRORLEVEL% == 0 (
23- SET PYTHONPATHTOKENS=4)
24-
25-ECHO Checking if python 2.7 is in the system
26-
27-:: Look for python 2.7
28-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
29-
30-IF NOT %PYTHONEXEPATH% == "" (
31- GOTO :PYTHONPRESENT)
32-
33-ECHO Checking if python 2.6 is in the system
34-:: we do not have python 2.7 in the system, try to find 2.6
35-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
36-
37-IF NOT %PYTHONEXEPATH% == "" (
38- GOTO :PYTHONPRESENT)
39-
40-:: we do not have python (2.6 or 2.7) this could hapen in the case that the
41-:: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
42-
43-:: Look for python 2.7 in WoW64
44-ECHO Checking if python 2.7 32 is in the system
45-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
46-
47-IF NOT %PYTHONEXEPATH% == "" (
48- GOTO :PYTHONPRESENT)
49-
50-ECHO Checking if python 2.6 32 is in the system
51-:: we do not have python 2.7 in the system, try to find 2.6
52-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
53-IF NOT %PYTHONEXEPATH% == "" (
54- GOTO :PYTHONPRESENT)
55-
56+ECHO Checking for Python on the path
57+:: Look for Python from buildout
58+FOR %%A in (python.exe) do (SET PYTHONEXEPATH=%%~$PATH:A)
59+FOR %%B in (u1trial) do (SET TRIALPATH=%%~$PATH:B)
60+FOR %%C in (u1lint) do (SET LINTPATH=%%~$PATH:C)
61+FOR %%D in (pep8.exe) do (SET PEP8PATH=%%~$PATH:D)
62+
63+IF NOT "%PYTHONEXEPATH%" == "" GOTO :PYTHONPRESENT
64 ECHO Please ensure you have python installed
65 GOTO :END
66
67 :PYTHONPRESENT
68-
69 :: throw the first parameter away if is /skip-lint,
70 :: the way we do this is to ensure that /skip-lint
71 :: is the first parameter and copy all the rest in a loop
72@@ -106,22 +65,27 @@
73 GOTO GETREST
74 :CONTINUEBATCH
75
76-ECHO Python found, executing the tests...
77+ECHO Python found at %PYTHONEXEPATH%, executing the tests...
78 :: execute the tests with a number of ignored linux only modules
79-"%PYTHONEXEPATH%\python.exe" bin/u1trial --reactor=twisted -c %PARAMS% ubuntuone
80+"%PYTHONEXEPATH%" "%TRIALPATH%" --reactor=twisted -c %PARAMS% ubuntuone
81
82 IF %SKIPLINT% == 1 (
83 ECHO Skipping style checks
84 GOTO :CLEAN)
85
86-"%PYTHONEXEPATH%\python.exe" bin/u1lint
87+"%PYTHONEXEPATH%" "%LINTPATH%"
88 :: test for style if we can, if pep8 is not present, move to the end
89-IF EXIST "%PYTHONEXEPATH%Scripts\pep8.exe"
90-START "Pep8" /B "%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat
91-ELSE
92+IF NOT EXIST "%PEP8PATH%" GOTO :NOPEP8
93+START "Pep8" /B "%PEP8PATH%" --repeat
94+:NOPEP8
95 ECHO Style checks were not done
96 :CLEAN
97+
98+IF EXIST \.coverage RMDIR /s /q \.coverage
99 :: Delete the temp folders
100-RMDIR /s /q _trial_temp
101-RMDIR /s /q .coverage
102+IF "%TRIAL_TEMP_DIR%" == "" GOTO :TRIALTEMPEXISTS
103+IF EXIST _trial_temp RMDIR /s /q _trial_temp
104+:TRIALTEMPEXISTS
105+IF EXIST "%TRIAL_TEMP_DIR%" RMDIR /s /q "%TRIAL_TEMP_DIR%"
106+
107 :END

Subscribers

People subscribed via source and target branches

to all changes: