Rev 6494: (gz) Run bt.test_setup in a more isolated environment (Martin Packman) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Mar 29 12:53:01 UTC 2012


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/2.5/

------------------------------------------------------------
revno: 6494 [merge]
revision-id: pqm at pqm.ubuntu.com-20120329125301-y49qakymoxms51fh
parent: pqm at pqm.ubuntu.com-20120327170704-leuw7drzi7exeois
parent: martin.packman at canonical.com-20120329112930-uq8m0n4jn8lhsak1
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.5
timestamp: Thu 2012-03-29 12:53:01 +0000
message:
  (gz) Run bt.test_setup in a more isolated environment (Martin Packman)
modified:
  bzrlib/tests/test_setup.py     test_setup.py-20051208073730-4a59a6368c4efa04
  doc/en/release-notes/bzr-2.5.txt bzr2.5.txt-20110708125756-587p0hpw7oke4h05-1
=== modified file 'bzrlib/tests/test_setup.py'
--- a/bzrlib/tests/test_setup.py	2011-01-12 01:01:53 +0000
+++ b/bzrlib/tests/test_setup.py	2012-03-29 11:24:16 +0000
@@ -21,19 +21,15 @@
 import subprocess
 
 import bzrlib
-from bzrlib.tests import TestCase, TestSkipped
-import bzrlib.osutils as osutils
+from bzrlib import tests
 
-# XXX: This clobbers the build directory in the real source tree; it'd be nice
-# to avoid that.
-#
 # TODO: Run bzr from the installed copy to see if it works.  Really we need to
 # run something that exercises every module, just starting it may not detect
 # some missing modules.
 #
 # TODO: Check that the version numbers are in sync.  (Or avoid this...)
 
-class TestSetup(TestCase):
+class TestSetup(tests.TestCaseInTempDir):
 
     def test_build_and_install(self):
         """ test cmd `python setup.py build`
@@ -45,30 +41,29 @@
         # are not necessarily invoked from there
         self.source_dir = os.path.dirname(os.path.dirname(bzrlib.__file__))
         if not os.path.isfile(os.path.join(self.source_dir, 'setup.py')):
-            raise TestSkipped(
+            self.skip(
                 'There is no setup.py file adjacent to the bzrlib directory')
         try:
             import distutils.sysconfig
             makefile_path = distutils.sysconfig.get_makefile_filename()
             if not os.path.exists(makefile_path):
-                raise TestSkipped(
+                self.skip(
                     'You must have the python Makefile installed to run this'
                     ' test. Usually this can be found by installing'
                     ' "python-dev"')
         except ImportError:
-            raise TestSkipped(
+            self.skip(
                 'You must have distutils installed to run this test.'
                 ' Usually this can be found by installing "python-dev"')
-        self.log('test_build running in %s' % os.getcwd())
-        root_dir = osutils.mkdtemp()
-        try:
-            self.run_setup(['clean'])
-            # build is implied by install
-            ## self.run_setup(['build'])
-            self.run_setup(['install', '--root', root_dir])
-            self.run_setup(['clean'])
-        finally:
-            osutils.rmtree(root_dir)
+        self.log('test_build running from %s' % self.source_dir)
+        build_dir = os.path.join(self.test_dir, "build")
+        install_dir = os.path.join(self.test_dir, "install")
+        self.run_setup([
+            'build', '-b', build_dir,
+            'install', '--root', install_dir])
+        # Install layout is platform dependant
+        self.assertPathExists(install_dir)
+        self.run_setup(['clean', '-b', build_dir])
 
     def run_setup(self, args):
         args = [sys.executable, './setup.py', ] + args

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2012-03-26 17:01:21 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2012-03-29 12:53:01 +0000
@@ -73,6 +73,9 @@
 * Add support for pyftpdlib >= 0.7.0 and drop support for previous pyftpdlib
   versions. (Vincent Ladeuil, #956027)
 
+* Run smoketest for setup.py isolated in a tempdir. (Martin Packman, #140874)
+
+
 bzr 2.5.0
 #########
 




More information about the bazaar-commits mailing list