~bzr-pqm/bzr/bzr.dev

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
7
8
from bzrlib.tests import TestCase
9
10
11
class TestSetup(TestCase):
12
13
    def setUp(self):
14
        pass
15
16
    def test_build(self):
17
        """ test cmd `python setup.py build` """
18
        # run setup.py build as subproces and catch return code
1185.31.59 by John Arbash Meinel
Switch to sys.executable instead of just 'python' to make sure to run the right executable
19
        p = subprocess.Popen([sys.executable, 'setup.py', 'build'],
20
                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
21
        s = p.communicate()
22
        self.assertEqual(0, p.returncode, '`python setup.py build` fails')
1185.33.89 by Martin Pool
[patch] add a selftest test that the setup build script works (Alexander Belchenko)
23
24
    def tearDown(self):
25
        """ cleanup build directory """
26
        shutil.rmtree(u'build')