bzr branch
http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
| 
1185.33.89
by Martin Pool
 [patch] add a selftest test that the setup build script works (Alexander Belchenko)  | 
1  | 
""" test for setup.py build process """
 | 
2  | 
||
3  | 
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  | 
4  | 
import sys  | 
5  | 
import subprocess  | 
|
| 
1185.33.89
by Martin Pool
 [patch] add a selftest test that the setup build script works (Alexander Belchenko)  | 
6  | 
import shutil  | 
| 
1540.3.32
by Martin Pool
 Clean up test_setup code; avoid possible pipe jam  | 
7  | 
from tempfile import TemporaryFile  | 
| 
1185.33.89
by Martin Pool
 [patch] add a selftest test that the setup build script works (Alexander Belchenko)  | 
8  | 
|
9  | 
from bzrlib.tests import TestCase  | 
|
10  | 
||
11  | 
||
| 
1540.3.31
by Martin Pool
 Fix up TestSetup.tearDown - shouldn't try to remove nonexistent directory  | 
12  | 
# TODO: ideally run this in a separate directory, so as not to clobber the
 | 
13  | 
# real build directory
 | 
|
14  | 
||
| 
1185.33.89
by Martin Pool
 [patch] add a selftest test that the setup build script works (Alexander Belchenko)  | 
15  | 
class TestSetup(TestCase):  | 
16  | 
||
17  | 
def test_build(self):  | 
|
| 
1540.3.31
by Martin Pool
 Fix up TestSetup.tearDown - shouldn't try to remove nonexistent directory  | 
18  | 
""" test cmd `python setup.py build`  | 
19  | 
        
 | 
|
20  | 
        This typically catches new subdirectories which weren't added to setup.py
 | 
|
21  | 
        """
 | 
|
| 
1540.3.32
by Martin Pool
 Clean up test_setup code; avoid possible pipe jam  | 
22  | 
self.log('test_build running in %s' % os.getcwd())  | 
23  | 
try:  | 
|
24  | 
            # run setup.py build as subproces and catch return code
 | 
|
25  | 
out_file = TemporaryFile()  | 
|
26  | 
err_file = TemporaryFile()  | 
|
27  | 
p = subprocess.Popen([sys.executable, 'setup.py', 'build'],  | 
|
28  | 
stdout=out_file, stderr=err_file)  | 
|
29  | 
s = p.communicate()  | 
|
30  | 
self.assertEqual(0, p.returncode, '`python setup.py build` fails')  | 
|
31  | 
finally:  | 
|
32  | 
if os.path.exists('build'):  | 
|
33  | 
shutil.rmtree(u'build')  |