Merge lp:~brian.curtin/dirspec/windows-buildout into lp:dirspec

Proposed by Brian Curtin
Status: Merged
Approved by: Diego Sarmentero
Approved revision: 12
Merged at revision: 12
Proposed branch: lp:~brian.curtin/dirspec/windows-buildout
Merge into: lp:dirspec
Diff against target: 57 lines (+18/-24)
1 file modified
run-tests.bat (+18/-24)
To merge this branch: bzr merge lp:~brian.curtin/dirspec/windows-buildout
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
dobey (community) Approve
Review via email: mp+115423@code.launchpad.net

Commit message

Adjust run-tests.bat to work with the Windows buildout environment.

Description of the change

Update run-tests.bat to work with our buildout environments.

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

+FOR %%B in (u1trial) do (SET TRIALPATH=%%~$PATH:B)

We are not using u1trial in dirspec, nor have we ever been (as it would introduce a circular dep, and now a dep on twisted which doesn't work with python3). This line should be removed.

review: Needs Fixing
12. By Brian Curtin

c&p error, trial isn't used here

Revision history for this message
Brian Curtin (brian.curtin) wrote :

Fixed. That was a block pasted in from the other run-tests.bat files.

windowsbatchlint would have caught that

Revision history for this message
dobey (dobey) :
review: Approve
Revision history for this message
Mike McCracken (mikemc) wrote :

Just left as a comment because I'm about to leave for a few days, but I can't run the tests with the buildout python - I think I must be missing a dependency somewhere?

C:\Users\mmccrack\Canonical\ubuntuone-windows-installer\scripts\devsetup\parts\dirspec>python setup.py test
running test
running egg_info
writing dirspec.egg-info\PKG-INFO
writing top-level names to dirspec.egg-info\top_level.txt
writing dependency_links to dirspec.egg-info\dependency_links.txt
reading manifest file 'dirspec.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'dirspec.egg-info\SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "C:\Users\mmccrack\Canonical\ubuntuone-windows-installer\scripts\devsetup\bin\python-script.py", line 58, in <module>
    execfile(__file__)
  File "setup.py", line 26, in <module>
    test_suite='dirspec.tests',
  File "C:\Python27\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\command\test.py", line 137, in run
    self.with_project_on_sys_path(self.run_tests)
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\command\test.py", line 117, in with_project_on_sys_path
    func()
  File "C:\Python27\lib\site-packages\distribute-0.6.27-py2.7.egg\setuptools\command\test.py", line 146, in run_tests
    testLoader = loader_class()
  File "C:\Python27\lib\unittest\main.py", line 94, in __init__
    self.parseArgs(argv)
  File "C:\Python27\lib\unittest\main.py", line 149, in parseArgs
    self.createTests()
  File "C:\Python27\lib\unittest\main.py", line 158, in createTests
    self.module)
  File "C:\Python27\lib\unittest\loader.py", line 128, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "C:\Python27\lib\unittest\loader.py", line 100, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'tests'

Revision history for this message
Brian Curtin (brian.curtin) wrote :

Ah yes, you need testtools installed. That's a part of a previous change to dirspec that Rodney made. If you manually add it to your buildout it'll work. I'll get it added to the buildout.cfg in bzr.

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

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-07-13 18:55:53 +0000
3+++ run-tests.bat 2012-07-17 20:59:23 +0000
4@@ -12,35 +12,29 @@
5 :: You should have received a copy of the GNU General Public License along
6 :: with this program. If not, see <http://www.gnu.org/licenses/>.
7 @ECHO off
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 PYTHONEXECPATH=""
11-:: This is very annoying; FOR /F will work differently depending on the output
12-:: of reg which is not consistent between OS versions (XP, 7). We must choose
13-:: the tokens according to OS version.
14-SET PYTHONPATHTOKENS=3
15-VER | FIND "XP" > nul
16-IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
17-ECHO Checking if python 2.7 is in the system
18-:: Look for python 2.7
19-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.7\InstallPath /ve') DO @SET PYTHONEXECPATH=%%A
20-IF NOT %PYTHONEXECPATH% == "" GOTO :PYTHONPRESENT
21-ECHO Checking if python 2.6 is in the system
22-:: we do not have python 2.7 in the system, try to find 2.6
23-FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONEXECPATH=%%A
24-IF NOT %PYTHONEXECPATH% == "" GOTO :PYTHONPRESENT
25-:: we do not have python (2.6 or 2.7), therefore we go to end
26+
27+SET PYTHONEXEPATH=""
28+SET PYTHONPATH=.
29+
30+ECHO Checking for Python on the path
31+:: Look for Python from buildout
32+FOR %%A in (python.exe) do (SET PYTHONEXEPATH=%%~$PATH:A)
33+FOR %%C in (pyflakes) do (SET FLAKESPATH=%%~$PATH:C)
34+FOR %%D in (pep8.exe) do (SET PEP8PATH=%%~$PATH:D)
35+
36+IF NOT "%PYTHONEXEPATH%" == "" GOTO :PYTHONPRESENT
37+
38 ECHO Please ensure you have python installed
39 GOTO :END
40
41 :PYTHONPRESENT
42 ECHO Python found, executing the tests...
43 :: execute the tests with a number of ignored linux only modules
44-"%PYTHONEXECPATH%\python.exe" setup.py build test clean
45-"%PYTHONEXECPATH%\python.exe" "%PYTHONEXECPATH%\Scripts\pyflakes" dirspec
46+"%PYTHONEXEPATH%" setup.py build test clean
47+"%PYTHONEXEPATH%" "%FLAKESPATH%" dirspec
48 :: test for style if we can, if pep8 is not present, move to the end
49-IF EXIST "%PYTHONEXECPATH%Scripts\pep8.exe"
50-"%PYTHONEXECPATH%\Scripts\pep8.exe" --repeat dirspec
51-ELSE
52-ECHO Style checks were not done
53+IF EXIST "%PEP8PATH%" (
54+"%PEP8PATH%" --repeat dirspec
55+)ELSE (
56+ECHO Style checks were not done)
57 :END

Subscribers

People subscribed via source and target branches