~dobey/ubuntu-sso-client/warning-color-tests

« back to all changes in this revision

Viewing changes to run-tests.bat

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
@ECHO off
29
29
 
30
 
:: We could have Python 2.6 or 2.7 on Windows. In order to check availability,
31
 
:: we should first check for 2.7, and run the tests, otherwise fall back to 2.6.
32
 
SET REGQUERY27="REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve"
33
 
SET REGQUERY2732="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.7\InstallPath /ve"
34
 
SET REGQUERY26="REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve"
35
 
SET REGQUERY2632="REG QUERY HKLM\Software\Wow6432Node\Python\PythonCore\2.6\InstallPath /ve"
36
30
SET PYTHONEXEPATH=""
37
31
 
38
 
:: This is very annoying; FOR /F will work differently depending on the output
39
 
:: of reg which is not consistent between OS versions (XP, 7). We must choose
40
 
:: the tokens according to OS version.
41
 
::
42
 
SET PYTHONPATHTOKENS=3
43
 
VER | FIND "XP" > nul
44
 
IF %ERRORLEVEL% == 0 (
45
 
    SET PYTHONPATHTOKENS=4)
46
 
 
47
 
ECHO Checking if python 2.7 is in the system
48
 
 
49
 
:: Look for python 2.7
50
 
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY27%') DO @SET PYTHONEXEPATH=%%A
51
 
 
52
 
IF NOT %PYTHONEXEPATH% == "" (
53
 
    GOTO :PYTHONPRESENT)
54
 
 
55
 
ECHO Checking if python 2.6 is in the system
56
 
:: we do not have python 2.7 in the system, try to find 2.6
57
 
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY26%') DO @SET PYTHONEXEPATH=%%A
58
 
 
59
 
IF NOT %PYTHONEXEPATH% == "" (
60
 
    GOTO :PYTHONPRESENT)
61
 
 
62
 
:: we do not have python (2.6 or 2.7) this could hapen in the case  that the
63
 
:: user installed the 32version in a 64 machine, let check if the software was installed in the wow key
64
 
 
65
 
:: Look for python 2.7 in WoW64
66
 
ECHO Checking if python 2.7 32 is in the system
67
 
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2732%') DO @SET PYTHONEXEPATH=%%A
68
 
 
69
 
IF NOT %PYTHONEXEPATH% == "" (
70
 
    GOTO :PYTHONPRESENT)
71
 
 
72
 
ECHO Checking if python 2.6 32 is in the system
73
 
:: we do not have python 2.7 in the system, try to find 2.6
74
 
FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('%REGQUERY2632%') DO @SET PYTHONEXEPATH=%%A
75
 
IF NOT %PYTHONEXEPATH% == "" (
76
 
    GOTO :PYTHONPRESENT)
77
 
 
 
32
set PYTHONPATH=.
 
33
 
 
34
ECHO Checking for Python on the path
 
35
:: Look for Python from buildout
 
36
FOR %%A in (python.exe) do (SET PYTHONEXEPATH=%%~$PATH:A)
 
37
FOR %%B in (u1trial) do (SET TRIALPATH=%%~$PATH:B)
 
38
FOR %%C in (u1lint) do (SET LINTPATH=%%~$PATH:C)
 
39
FOR %%D in (pep8.exe) do (SET PEP8PATH=%%~$PATH:D)
 
40
 
 
41
IF NOT "%PYTHONEXEPATH%" == "" GOTO :PYTHONPRESENT
78
42
ECHO Please ensure you have python installed
79
43
GOTO :END
80
44
 
81
 
 
82
45
:PYTHONPRESENT
83
 
 
84
46
:: throw the first parameter away if is /skip-lint,
85
47
:: the way we do this is to ensure that /skip-lint
86
48
:: is the first parameter and copy all the rest in a loop
106
68
GOTO GETREST
107
69
:CONTINUEBATCH
108
70
 
109
 
ECHO Python found, building auto-generated modules...
 
71
ECHO Python found at %PYTHONEXEPATH%, building auto-generated modules...
110
72
:: call setup.py build so that the qt uic is called
111
73
::START "Build code" /D%CD% /WAIT "%PYTHONEXEPATH%\python.exe" setup.py build
112
 
"%PYTHONEXEPATH%\python.exe" setup.py build
 
74
"%PYTHONEXEPATH%" setup.py build
113
75
ECHO Running tests
114
76
:: execute the tests with a number of ignored linux only modules
115
 
"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1trial" -i "test_linux.py, test_txsecrets.py, test_qt.py, test_glib.py" -p "ubuntu_sso\gtk" --reactor=qt4 --gui %PARAMS% ubuntu_sso 
 
77
"%PYTHONEXEPATH%" "%TRIALPATH%" -i "test_linux.py, test_txsecrets.py, test_qt.py, test_glib.py" -p "ubuntu_sso\gtk" --reactor=qt4 --gui %PARAMS% ubuntu_sso
116
78
:: Clean the build from the setupt.py
117
 
ECHO Cleaning the generated code
118
 
"%PYTHONEXEPATH%\python.exe" setup.py clean
 
79
ECHO Cleaning the generated code before running the style checks...
 
80
"%PYTHONEXEPATH%" setup.py clean
119
81
 
120
82
IF %SKIPLINT% == 1 (
121
83
    ECHO Skipping style checks
123
85
 
124
86
ECHO Performing style checks...
125
87
SET IGNORE_LINT="ubuntu_sso\gtk,ubuntu_sso\networkstate\linux.py,ubuntu_sso\main\linux.py,ubuntu_sso\main\tests\test_linux.py,ubuntu_sso\utils\txsecrets.py,ubuntu_sso\utils\tests\test_txsecrets.py,ubuntu_sso\tests\bin,bin\ubuntu-sso-login"
126
 
"%PYTHONEXEPATH%\python.exe" "%PYTHONEXEPATH%\Scripts\u1lint" -i "%IGNORE_LINT%" ubuntu_sso
 
88
"%PYTHONEXEPATH%" "%LINTPATH%" -i "%IGNORE_LINT%" ubuntu_sso
127
89
:: test for style if we can, if pep8 is not present, move to the end
128
 
"%PYTHONEXEPATH%\Scripts\pep8.exe" --repeat .
 
90
ECHO Running PEP-8 Check...
 
91
"%PEP8PATH%" --repeat .
129
92
:CLEAN
 
93
 
 
94
IF EXIST \.coverage RMDIR /s /q \.coverage
130
95
:: Delete the temp folders
131
 
RMDIR /q /s _trial_temp
132
 
DEL /q .coverage
 
96
IF "%TRIAL_TEMP_DIR%" == "" GOTO :TRIALTEMPEXISTS
 
97
IF EXIST _trial_temp RMDIR /s /s _trial_temp
 
98
:TRIALTEMPEXISTS
 
99
IF EXIST "%TRIAL_TEMP_DIR%" RMDIR /s /s "%TRIAL_TEMP_DIR%"
 
100
 
133
101
:END