Merge lp:~mandel/ubuntuone-dev-tools/add_tests_batch into lp:ubuntuone-dev-tools

Proposed by Manuel de la Peña on 2010-12-20
Status: Merged
Approved by: Manuel de la Peña on 2010-12-20
Approved revision: 18
Merged at revision: 16
Proposed branch: lp:~mandel/ubuntuone-dev-tools/add_tests_batch
Merge into: lp:ubuntuone-dev-tools
Diff against target: 57 lines (+52/-0)
1 file modified
run-tests.bat (+52/-0)
To merge this branch: bzr merge lp:~mandel/ubuntuone-dev-tools/add_tests_batch
Reviewer Review Type Date Requested Status
dobey (community) 2010-12-20 Approve on 2010-12-20
Roberto Alsina (community) Approve on 2010-12-20
Review via email: mp+44207@code.launchpad.net

Commit Message

Added a .bat that will find the path where python is installed and will ran the tests so that lp:692494 is fixed.

Description of the Change

Added a .bat that will find the path where python is installed and will ran the tests so that lp:692494 is fixed.

To post a comment you must log in.
dobey (dobey) wrote :

22 +:: We coudl have python 2.6 or 2.7 on windows, to in order to find which one we
23 +:: have, we will first try to get the path to 2.6, if found we will move to
24 +:: execute the tests, otherwhise we try to find 2.7 and move on
25 +SET PYTHONPATH=""
26 +:: This is very anoying, FOR /F will work differently depending on the output
27 +:: of reg which is not consistent between os (xp, 7) we have to choose the tokens
28 +:: according to the os

Spelling and grammar errors abound.

:: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
:: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.

:: This is very annoying; FOR /F will work differently depending on the output
:: of reg which is not consistent between OS versions (XP, 7). We must choose
:: the tokens according to OS version.

Also, as per the first comment, you should change the Python checks to look for 2.7 first, and then fall back to 2.6.

review: Needs Fixing
Roberto Alsina (ralsina) wrote :

Works.

review: Approve
16. By Manuel de la Peña on 2010-12-20

Fixed typo. Check for 2.7 before than 2.6

dobey (dobey) wrote :

The comments I mentioned previously still have some errors. It looks like you only fixed a couple of spelling errors, and not the grammar or other issues in the comments. The ones I suggested are much better to use there, as they more clearly describe what's going on.

17. By Manuel de la Peña on 2010-12-20

Use sensible comments.

dobey (dobey) :
review: Approve
dobey (dobey) wrote :

Actually, let's just rename the file to run-tests.bat instead. There's no need for the -windows, as the .bat pretty much indicates that much; and it will keep consistency with other platforms.

review: Needs Fixing
18. By Manuel de la Peña on 2010-12-20

Renaming script to be consistent with the linux naming currently used.

dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'run-tests.bat'
2--- run-tests.bat 1970-01-01 00:00:00 +0000
3+++ run-tests.bat 2010-12-20 16:18:10 +0000
4@@ -0,0 +1,52 @@
5+:: Author: Manuel de la Pena <manuel@canonical.com>
6+::
7+:: Copyright 2010 Canonical Ltd.
8+::
9+:: This program is free software: you can redistribute it and/or modify it
10+:: under the terms of the GNU General Public License version 3, as published
11+:: by the Free Software Foundation.
12+::
13+:: This program is distributed in the hope that it will be useful, but
14+:: WITHOUT ANY WARRANTY; without even the implied warranties of
15+:: MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
16+:: PURPOSE. See the GNU General Public License for more details.
17+::
18+:: You should have received a copy of the GNU General Public License along
19+:: with this program. If not, see <http://www.gnu.org/licenses/>.
20+@ECHO off
21+:: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
22+:: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
23+SET PYTHONPATH=""
24+:: This is very annoying; FOR /F will work differently depending on the output
25+:: of reg which is not consistent between OS versions (XP, 7). We must choose
26+:: the tokens according to OS version.
27+SET PYTHONPATHTOKENS=3
28+VER | FIND "XP" > nul
29+IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
30+ECHO Checking if python 2.7 is in the system
31+:: Look for python 2.7
32+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONPATH=%%A
33+IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT
34+ECHO Checking if python 2.6 is in the system
35+:: we do not have python 2.7 in the system, try to find 2.6
36+FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONPATH=%%A
37+IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT
38+:: we do not have python (2.6 or 2.7), therefore we go to end
39+ECHO Please ensure you have python installed
40+GOTO :END
41+
42+
43+:PYTHONPRESENT
44+ECHO Python found, executing the tests...
45+:: execute the tests with a number of ignored linux only modules
46+"%PYTHONPATH%\python.exe" bin/u1trial -c ubuntuone
47+"%PYTHONPATH%\python.exe" bin/u1lint
48+:: test for style if we can, if pep8 is not present, move to the end
49+IF EXIST "%PYTHONPATH%Scripts\pep8.exe"
50+START "Pep8" /B "%PYTHONPATH%\Scripts\pep8.exe" --repeat
51+ELSE
52+ECHO Style checks were not done
53+:: Delete the temp folders
54+RMDIR /s /q _trial_temp
55+RMDIR /s /q .coverage
56+:END
57\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: