1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
1 |
# Copyright (C) 2005, 2006 by Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
3 |
# This program is free software; you can redistribute it and/or modify
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
8 |
# This program is distributed in the hope that it will be useful,
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
13 |
# You should have received a copy of the GNU General Public License
|
14 |
# along with this program; if not, write to the Free Software
|
|
15 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
16 |
||
1185.33.89
by Martin Pool
[patch] add a selftest test that the setup build script works (Alexander Belchenko) |
17 |
""" test for setup.py build process """
|
18 |
||
19 |
import os |
|
1185.31.59
by John Arbash Meinel
Switch to sys.executable instead of just 'python' to make sure to run the right executable |
20 |
import sys |
21 |
import subprocess |
|
1185.33.89
by Martin Pool
[patch] add a selftest test that the setup build script works (Alexander Belchenko) |
22 |
import shutil |
1540.3.32
by Martin Pool
Clean up test_setup code; avoid possible pipe jam |
23 |
from tempfile import TemporaryFile |
1185.33.89
by Martin Pool
[patch] add a selftest test that the setup build script works (Alexander Belchenko) |
24 |
|
25 |
from bzrlib.tests import TestCase |
|
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
26 |
import bzrlib.osutils as osutils |
1185.33.89
by Martin Pool
[patch] add a selftest test that the setup build script works (Alexander Belchenko) |
27 |
|
1540.3.31
by Martin Pool
Fix up TestSetup.tearDown - shouldn't try to remove nonexistent directory |
28 |
# TODO: ideally run this in a separate directory, so as not to clobber the
|
29 |
# real build directory
|
|
30 |
||
1185.33.89
by Martin Pool
[patch] add a selftest test that the setup build script works (Alexander Belchenko) |
31 |
class TestSetup(TestCase): |
32 |
||
33 |
def test_build(self): |
|
1540.3.31
by Martin Pool
Fix up TestSetup.tearDown - shouldn't try to remove nonexistent directory |
34 |
""" test cmd `python setup.py build`
|
35 |
|
|
36 |
This typically catches new subdirectories which weren't added to setup.py
|
|
37 |
"""
|
|
1540.3.32
by Martin Pool
Clean up test_setup code; avoid possible pipe jam |
38 |
self.log('test_build running in %s' % os.getcwd()) |
39 |
try: |
|
40 |
# run setup.py build as subproces and catch return code
|
|
41 |
out_file = TemporaryFile() |
|
42 |
err_file = TemporaryFile() |
|
43 |
p = subprocess.Popen([sys.executable, 'setup.py', 'build'], |
|
44 |
stdout=out_file, stderr=err_file) |
|
45 |
s = p.communicate() |
|
46 |
self.assertEqual(0, p.returncode, '`python setup.py build` fails') |
|
47 |
finally: |
|
48 |
if os.path.exists('build'): |
|
1692.7.6
by Martin Pool
[patch] force deletion of trees containing readonly files (alexander) |
49 |
osutils.rmtree(u'build') |