bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
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  | 
|
| 
1911.1.2
by Alexander Belchenko
 test_setup: skip test if there is no 'setup.py' in current directory.  | 
25  | 
from bzrlib.tests import TestCase, TestSkipped  | 
| 
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`  | 
| 
1821.1.1
by Alexander Belchenko
 win32 installer for bzr.dev.0.9  | 
35  | 
|
| 
1861.2.15
by Alexander Belchenko
 English phrases corrected as John Meinel suggested.  | 
36  | 
        This tests that the build process and man generator run correctly.
 | 
37  | 
        It also can catch new subdirectories that weren't added to setup.py.
 | 
|
| 
1540.3.31
by Martin Pool
 Fix up TestSetup.tearDown - shouldn't try to remove nonexistent directory  | 
38  | 
        """
 | 
| 
1911.1.2
by Alexander Belchenko
 test_setup: skip test if there is no 'setup.py' in current directory.  | 
39  | 
if not os.path.isfile('setup.py'):  | 
40  | 
raise TestSkipped('There is no setup.py file in current directory')  | 
|
41  | 
||
| 
1540.3.32
by Martin Pool
 Clean up test_setup code; avoid possible pipe jam  | 
42  | 
self.log('test_build running in %s' % os.getcwd())  | 
43  | 
try:  | 
|
44  | 
            # run setup.py build as subproces and catch return code
 | 
|
45  | 
out_file = TemporaryFile()  | 
|
46  | 
err_file = TemporaryFile()  | 
|
47  | 
p = subprocess.Popen([sys.executable, 'setup.py', 'build'],  | 
|
48  | 
stdout=out_file, stderr=err_file)  | 
|
49  | 
s = p.communicate()  | 
|
50  | 
self.assertEqual(0, p.returncode, '`python setup.py build` fails')  | 
|
51  | 
finally:  | 
|
52  | 
if os.path.exists('build'):  | 
|
| 
1692.7.6
by Martin Pool
 [patch] force deletion of trees containing readonly files (alexander)  | 
53  | 
osutils.rmtree(u'build')  |