Rev 3566: (mbp) Use test names in the temporary directory name in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jul 21 10:27:36 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3566
revision-id:pqm at pqm.ubuntu.com-20080721092720-z0bvnt4ljysbqjis
parent: pqm at pqm.ubuntu.com-20080718100017-segv2csk7ux2xs9p
parent: mbp at sourcefrog.net-20080721085833-9s05ca14867t4ww3
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2008-07-21 10:27:20 +0100
message:
  (mbp) Use test names in the temporary directory name
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
    ------------------------------------------------------------
    revno: 3549.2.4
    revision-id:mbp at sourcefrog.net-20080721085833-9s05ca14867t4ww3
    parent: mbp at sourcefrog.net-20080721080723-bj3tobeir4xf7f3s
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: lock-warnings
    timestamp: Mon 2008-07-21 18:58:33 +1000
    message:
      Rename _getTestDirPrefix not to look like a test
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 3549.2.3
    revision-id:mbp at sourcefrog.net-20080721080723-bj3tobeir4xf7f3s
    parent: mbp at sourcefrog.net-20080721074830-i1pgj2hswpfo6pav
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: lock-warnings
    timestamp: Mon 2008-07-21 18:07:23 +1000
    message:
      Remove import of now-deprecated MultipleRevisionSources
    modified:
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
    ------------------------------------------------------------
    revno: 3549.2.2
    revision-id:mbp at sourcefrog.net-20080721074830-i1pgj2hswpfo6pav
    parent: mbp at sourcefrog.net-20080717065451-aa6bw10px29222mh
    parent: pqm at pqm.ubuntu.com-20080718030707-qimx9fv1d4xhlk1m
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: lock-warnings
    timestamp: Mon 2008-07-21 17:48:30 +1000
    message:
      merge trunk
    added:
      bzrlib/_walkdirs_win32.h       _walkdirs_win32.h-20080716220454-kweh3tgxez5dvw2l-1
      bzrlib/_walkdirs_win32.pyx     _walkdirs_win32.pyx-20080716220454-kweh3tgxez5dvw2l-2
      bzrlib/tests/test__walkdirs_win32.py test__walkdirs_win32-20080716220454-kweh3tgxez5dvw2l-3
      doc/en/user-guide/stacked.txt  stacked.txt-20080711023247-4uh9oovoka0sze8b-1
    modified:
      .bzrignore                     bzrignore-20050311232317-81f7b71efa2db11a
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/__init__.py             __init__.py-20050309040759-33e65acf91bbcd5d
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
      bzrlib/knit.py                 knit.py-20051212171256-f056ac8f0fbe1bd9
      bzrlib/lockable_files.py       control_files.py-20051111201905-bb88546e799d669f
      bzrlib/log.py                  log.py-20050505065812-c40ce11702fe5fb1
      bzrlib/lsprof.py               lsprof.py-20051208071030-833790916798ceed
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/push.py                 push.py-20080606021927-5fe39050e8xne9un-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_branch.py test_branch.py-20060524161337-noms9gmcwqqrfi8y-1
      bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
      bzrlib/tests/blackbox/test_push.py test_push.py-20060329002750-929af230d5d22663
      bzrlib/tests/branch_implementations/test_hooks.py test_hooks.py-20070129154855-blhpwxmvjs07waei-1
      bzrlib/tests/repository_implementations/__init__.py __init__.py-20060131092037-9564957a7d4a841b
      bzrlib/tests/test_log.py       testlog.py-20050728115707-1a514809d7d49309
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
      bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
      bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
      bzrlib/tests/workingtree_implementations/__init__.py __init__.py-20060203003124-b2aa5aca21a8bfad
      bzrlib/transport/local.py      local_transport.py-20050711165921-9b1f142bfe480c24
      bzrlib/transport/sftp.py       sftp.py-20051019050329-ab48ce71b7e32dfe
      bzrlib/urlutils.py             urlutils.py-20060502195429-e8a161ecf8fac004
      bzrlib/versionedfile.py        versionedfile.py-20060222045106-5039c71ee3b65490
      doc/en/user-guide/index.txt    index.txt-20060622101119-tgwtdci8z769bjb9-2
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
    ------------------------------------------------------------
    revno: 3549.2.1
    revision-id:mbp at sourcefrog.net-20080717065451-aa6bw10px29222mh
    parent: pqm at pqm.ubuntu.com-20080717023455-idnyms69oiauf7fh
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: lock-warnings
    timestamp: Thu 2008-07-17 16:54:51 +1000
    message:
      Use test names in the temporary directory name
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-07-17 12:55:11 +0000
+++ b/bzrlib/tests/__init__.py	2008-07-21 08:58:33 +0000
@@ -2041,16 +2041,32 @@
             self.log("actually: %r" % contents)
             self.fail("contents of %s not as expected" % filename)
 
+    def _getTestDirPrefix(self):
+        # create a directory within the top level test directory
+        if sys.platform == 'win32':
+            name_prefix = re.sub('[<>*=+",:;_/\\-]', '_', self.id())
+            # windows is likely to have path-length limits so use a short name
+            name_prefix = name_prefix[-30:]
+        else:
+            name_prefix = re.sub('[/]', '_', self.id())
+        return name_prefix
+
     def makeAndChdirToTestDir(self):
         """See TestCaseWithMemoryTransport.makeAndChdirToTestDir().
         
         For TestCaseInTempDir we create a temporary directory based on the test
         name and then create two subdirs - test and home under it.
         """
-        # create a directory within the top level test directory
-        candidate_dir = osutils.mkdtemp(dir=self.TEST_ROOT)
+        name_prefix = os.path.join(self.TEST_ROOT, self._getTestDirPrefix())
+        name = name_prefix
+        for i in range(100):
+            if os.path.exists(name):
+                name = name_prefix + '_' + str(i)
+            else:
+                os.mkdir(name)
+                break
         # now create test and home directories within this dir
-        self.test_base_dir = candidate_dir
+        self.test_base_dir = name
         self.test_home_dir = self.test_base_dir + '/home'
         os.mkdir(self.test_home_dir)
         self.test_dir = self.test_base_dir + '/work'

=== modified file 'bzrlib/tests/test_revision.py'
--- a/bzrlib/tests/test_revision.py	2008-05-12 02:40:40 +0000
+++ b/bzrlib/tests/test_revision.py	2008-07-21 08:07:23 +0000
@@ -142,12 +142,6 @@
         wt2.merge_from_branch(self.br1)
         wt2.commit("Commit fifteen", rev_id="b at u-0-10")
 
-        from bzrlib.revision import MultipleRevisionSources
-        self.sources = self.applyDeprecated(one_three,
-                        MultipleRevisionSources, self.br1.repository,
-                                                 self.br2.repository)
-
-
 
 class MockRevisionSource(object):
     """A RevisionSource that takes a pregenerated graph.




More information about the bazaar-commits mailing list