Rev 2957: selftest: use SymlinkFeature instead of TestSkipped where appropriate in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Nov 3 02:37:43 GMT 2007


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

------------------------------------------------------------
revno: 2957
revision-id: pqm at pqm.ubuntu.com-20071103023739-e0wzok4qpvzq66sa
parent: pqm at pqm.ubuntu.com-20071103015330-pt1tec7wyxwwcey8
parent: bialix at ukr.net-20071102051217-5ebfnblbcihhut5g
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2007-11-03 02:37:39 +0000
message:
  selftest: use SymlinkFeature instead of TestSkipped where appropriate
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_debug.py test_debug.py-20061026142942-q76cgg41785b3mdk-1
  bzrlib/tests/blackbox/test_ignore.py test_ignore.py-20060703063225-4tm8dc2pa7wwg2t3-1
  bzrlib/tests/blackbox/test_mv.py test_mv.py-20060705114902-33tkxz0o9cdshemo-1
  bzrlib/tests/blackbox/test_update.py test_update.py-20060212125639-c4dad1a5c56d5919
  bzrlib/tests/branch_implementations/test_branch.py testbranch.py-20050711070244-121d632bc37d7253
  bzrlib/tests/branch_implementations/test_break_lock.py test_break_lock.py-20060504111902-9aae411dbe9aadd2
  bzrlib/tests/branch_implementations/test_pull.py test_pull.py-20060410103942-83c35b26657414fc
  bzrlib/tests/branch_implementations/test_push.py test_push.py-20070130153159-fhfap8uoifevg30j-1
  bzrlib/tests/branch_implementations/test_sprout.py test_sprout.py-20070521151739-b8t8p7axw1h966ws-1
  bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
  bzrlib/tests/test_bad_files.py test_bad_files.py-20050918155938-c76a2295c8ab9503
  bzrlib/tests/test_bundle.py    test.py-20050630184834-092aa401ab9f039c
  bzrlib/tests/test_commit.py    test_commit.py-20050914060732-279f057f8c295434
  bzrlib/tests/test_commit_merge.py test_commit_merge.py-20050920084723-819eeeff77907bc5
  bzrlib/tests/test_dirstate.py  test_dirstate.py-20060728012006-d6mvoihjb3je9peu-2
  bzrlib/tests/test_hashcache.py testhashcache.py-20050706091800-0288ab2659338981
  bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
  bzrlib/tests/test_osutils_encodings.py test_osutils_encodin-20061226013130-kkp732tpt3lm91vv-1
  bzrlib/tests/test_testament.py testtestament.py-20051011100429-5df1657310caa929
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/tests/tree_implementations/test_get_symlink_target.py test_get_symlink_tar-20070225165554-ickod3w3t7u0zzqh-1
  bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
  bzrlib/tests/tree_implementations/test_test_trees.py test_tree_trees.py-20060720091921-3nwi5h21lf06vf5p-1
  bzrlib/tests/workingtree_implementations/test_commit.py test_commit.py-20060421013633-1610ec2331c8190f
  bzrlib/tests/workingtree_implementations/test_pull.py test_pull.py-20060222044334-43594dd8e143b708
  bzrlib/tests/workingtree_implementations/test_walkdirs.py test_walkdirs.py-20060731045042-ch366w6dve2m7ro9-1
  bzrlib/tests/workingtree_implementations/test_workingtree.py test_workingtree.py-20060203003124-817757d3e31444fb
    ------------------------------------------------------------
    revno: 2949.5.2
    merged: bialix at ukr.net-20071102051217-5ebfnblbcihhut5g
    parent: bialix at ukr.net-20071101095245-qmmtwknzalx2b33u
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: symlink.feature
    timestamp: Fri 2007-11-02 07:12:17 +0200
    message:
      John's review
    ------------------------------------------------------------
    revno: 2949.5.1
    merged: bialix at ukr.net-20071101095245-qmmtwknzalx2b33u
    parent: pqm at pqm.ubuntu.com-20071029221703-zy7q7a0ehfvpybtn
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: symlink.feature
    timestamp: Thu 2007-11-01 11:52:45 +0200
    message:
      selftest: use SymlinkFeature instead of TestSkipped where appropriate
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-10-31 11:45:45 +0000
+++ b/bzrlib/tests/__init__.py	2007-11-03 02:37:39 +0000
@@ -2663,6 +2663,17 @@
 SymlinkFeature = _SymlinkFeature()
 
 
+class _OsFifoFeature(Feature):
+
+    def _probe(self):
+        return getattr(os, 'mkfifo', None)
+
+    def feature_name(self):
+        return 'filesystem fifos'
+
+OsFifoFeature = _OsFifoFeature()
+
+
 class TestScenarioApplier(object):
     """A tool to apply scenarios to tests."""
 

=== modified file 'bzrlib/tests/blackbox/test_debug.py'
--- a/bzrlib/tests/blackbox/test_debug.py	2007-08-03 02:52:23 +0000
+++ b/bzrlib/tests/blackbox/test_debug.py	2007-11-01 09:52:45 +0000
@@ -21,7 +21,8 @@
 import sys
 import time
 
-from bzrlib.tests import TestCaseInTempDir, TestSkipped
+from bzrlib.tests import TestCaseInTempDir
+
 
 class TestDebugOption(TestCaseInTempDir):
 

=== modified file 'bzrlib/tests/blackbox/test_ignore.py'
--- a/bzrlib/tests/blackbox/test_ignore.py	2007-09-05 01:38:34 +0000
+++ b/bzrlib/tests/blackbox/test_ignore.py	2007-11-01 09:52:45 +0000
@@ -31,7 +31,6 @@
 import bzrlib.bzrdir as bzrdir
 from bzrlib.errors import BzrCommandError
 from bzrlib.osutils import (
-    has_symlinks,
     pathjoin,
     terminal_width,
     )

=== modified file 'bzrlib/tests/blackbox/test_mv.py'
--- a/bzrlib/tests/blackbox/test_mv.py	2007-08-23 14:10:48 +0000
+++ b/bzrlib/tests/blackbox/test_mv.py	2007-11-01 09:52:45 +0000
@@ -24,8 +24,8 @@
     )
 
 from bzrlib.tests import (
+    SymlinkFeature,
     TestCaseWithTransport,
-    TestSkipped,
     )
 
 
@@ -135,8 +135,7 @@
         self.run_bzr('rename b a')
 
     def test_mv_through_symlinks(self):
-        if not osutils.has_symlinks():
-            raise TestSkipped('Symlinks are not supported on this platform')
+        self.requireFeature(SymlinkFeature)
         tree = self.make_branch_and_tree('.')
         self.build_tree(['a/', 'a/b'])
         os.symlink('a', 'c')

=== modified file 'bzrlib/tests/blackbox/test_update.py'
--- a/bzrlib/tests/blackbox/test_update.py	2007-08-08 02:01:10 +0000
+++ b/bzrlib/tests/blackbox/test_update.py	2007-11-01 09:52:45 +0000
@@ -21,7 +21,6 @@
 import os
 
 from bzrlib import branch, bzrdir
-from bzrlib.tests import TestSkipped
 from bzrlib.tests.blackbox import ExternalBase
 from bzrlib.workingtree import WorkingTree
 

=== modified file 'bzrlib/tests/branch_implementations/test_branch.py'
--- a/bzrlib/tests/branch_implementations/test_branch.py	2007-10-22 01:23:51 +0000
+++ b/bzrlib/tests/branch_implementations/test_branch.py	2007-11-01 09:52:45 +0000
@@ -167,7 +167,7 @@
 
     def test_clone_branch_nickname(self):
         # test the nick name is preserved always
-        raise TestSkipped('XXX branch cloning is not yet tested..')
+        raise TestSkipped('XXX branch cloning is not yet tested.')
 
     def test_clone_branch_parent(self):
         # test the parent is preserved always

=== modified file 'bzrlib/tests/branch_implementations/test_break_lock.py'
--- a/bzrlib/tests/branch_implementations/test_break_lock.py	2006-10-05 05:37:25 +0000
+++ b/bzrlib/tests/branch_implementations/test_break_lock.py	2007-11-01 09:52:45 +0000
@@ -20,7 +20,7 @@
 
 import bzrlib
 import bzrlib.errors as errors
-from bzrlib.tests import TestCase, TestCaseWithTransport, TestSkipped
+from bzrlib.tests import TestCase, TestCaseWithTransport
 from bzrlib.tests.branch_implementations.test_branch import TestCaseWithBranch
 
 

=== modified file 'bzrlib/tests/branch_implementations/test_pull.py'
--- a/bzrlib/tests/branch_implementations/test_pull.py	2007-05-04 08:46:39 +0000
+++ b/bzrlib/tests/branch_implementations/test_pull.py	2007-11-01 09:52:45 +0000
@@ -23,7 +23,6 @@
 from bzrlib import errors
 from bzrlib.memorytree import MemoryTree
 from bzrlib.revision import NULL_REVISION
-from bzrlib.tests import TestSkipped
 from bzrlib.tests.branch_implementations.test_branch import TestCaseWithBranch
 
 

=== modified file 'bzrlib/tests/branch_implementations/test_push.py'
--- a/bzrlib/tests/branch_implementations/test_push.py	2007-05-07 12:03:14 +0000
+++ b/bzrlib/tests/branch_implementations/test_push.py	2007-11-01 09:52:45 +0000
@@ -24,7 +24,6 @@
 from bzrlib.memorytree import MemoryTree
 from bzrlib.remote import RemoteBranch
 from bzrlib.revision import NULL_REVISION
-from bzrlib.tests import TestSkipped
 from bzrlib.tests.branch_implementations.test_branch import TestCaseWithBranch
 from bzrlib.transport.local import LocalURLServer
 

=== modified file 'bzrlib/tests/branch_implementations/test_sprout.py'
--- a/bzrlib/tests/branch_implementations/test_sprout.py	2007-09-05 04:35:21 +0000
+++ b/bzrlib/tests/branch_implementations/test_sprout.py	2007-11-01 09:52:45 +0000
@@ -28,7 +28,7 @@
 
     def test_sprout_branch_nickname(self):
         # test the nick name is reset always
-        raise tests.TestSkipped('XXX branch sprouting is not yet tested..')
+        raise tests.TestSkipped('XXX branch sprouting is not yet tested.')
 
     def test_sprout_branch_parent(self):
         source = self.make_branch('source')

=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py	2007-09-05 03:23:20 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py	2007-11-01 09:52:45 +0000
@@ -953,7 +953,6 @@
         tree2.set_root_id(tree1.get_root_id())
         self.build_tree(['tree1/fromfile', 'tree1/fromdir/'])
         self.build_tree(['tree2/tofile', 'tree2/todir/', 'tree2/unknown'])
-        # try:
         os.symlink('original', 'tree1/changed')
         os.symlink('original', 'tree1/removed')
         os.symlink('original', 'tree1/tofile')
@@ -986,14 +985,10 @@
             ]
         tree1.add(from_paths_and_ids, from_paths_and_ids)
         tree2.add(to_paths_and_ids, to_paths_and_ids)
-        # except ???:
-        #   raise TestSkipped('OS does not support symlinks')
-        #   links_supported = False
         return self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
     def test_versioned_symlinks(self):
-        if not has_symlinks():
-            raise tests.TestSkipped("No symlink support")
+        self.requireFeature(tests.SymlinkFeature)
         tree1, tree2 = self.make_trees_with_symlinks()
         root_id = tree1.path2id('')
         expected = [
@@ -1014,8 +1009,7 @@
                 want_unversioned=True))
 
     def test_versioned_symlinks_specific_files(self):
-        if not has_symlinks():
-            raise tests.TestSkipped("No symlink support")
+        self.requireFeature(tests.SymlinkFeature)
         tree1, tree2 = self.make_trees_with_symlinks()
         root_id = tree1.path2id('')
         expected = [

=== modified file 'bzrlib/tests/test_bad_files.py'
--- a/bzrlib/tests/test_bad_files.py	2007-07-04 02:43:26 +0000
+++ b/bzrlib/tests/test_bad_files.py	2007-11-02 05:12:17 +0000
@@ -25,7 +25,7 @@
     errors,
     )
 from bzrlib.status import show_tree_status
-from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests import OsFifoFeature, TestCaseWithTransport
 
 
 def verify_status(tester, tree, value):
@@ -40,10 +40,7 @@
 
     def test_bad_files(self):
         """Test that bzr will ignore files it doesn't like"""
-        if getattr(os, 'mkfifo', None) is None:
-            # TODO: Ultimately this should be TestSkipped
-            # or PlatformDeficiency
-            return
+        self.requireFeature(OsFifoFeature)
 
         wt = self.make_branch_and_tree('.')
         b = wt.branch

=== modified file 'bzrlib/tests/test_bundle.py'
--- a/bzrlib/tests/test_bundle.py	2007-09-24 08:46:35 +0000
+++ b/bzrlib/tests/test_bundle.py	2007-11-01 09:52:45 +0000
@@ -40,9 +40,15 @@
                            NoSuchFile,)
 from bzrlib.merge import Merge3Merger
 from bzrlib.repofmt import knitrepo
-from bzrlib.osutils import has_symlinks, sha_file
-from bzrlib.tests import (TestCaseInTempDir, TestCaseWithTransport,
-                          TestCase, TestSkipped, test_commit)
+from bzrlib.osutils import sha_file
+from bzrlib.tests import (
+    SymlinkFeature,
+    TestCase,
+    TestCaseInTempDir,
+    TestCaseWithTransport,
+    TestSkipped,
+    test_commit,
+    )
 from bzrlib.transform import TreeTransform
 
 
@@ -641,8 +647,7 @@
         bundle = self.get_valid_bundle('a at cset-0-6', 'a at cset-0-7')
 
     def test_symlink_bundle(self):
-        if not has_symlinks():
-            raise TestSkipped("No symlink support")
+        self.requireFeature(SymlinkFeature)
         self.tree1 = self.make_branch_and_tree('b1')
         self.b1 = self.tree1.branch
         tt = TreeTransform(self.tree1)

=== modified file 'bzrlib/tests/test_commit.py'
--- a/bzrlib/tests/test_commit.py	2007-10-03 05:25:50 +0000
+++ b/bzrlib/tests/test_commit.py	2007-11-01 09:52:45 +0000
@@ -30,7 +30,7 @@
 from bzrlib.config import BranchConfig
 from bzrlib.errors import (PointlessCommit, BzrError, SigningFailed, 
                            LockContention)
-from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests import SymlinkFeature, TestCaseWithTransport
 from bzrlib.workingtree import WorkingTree
 
 
@@ -584,8 +584,7 @@
             basis.unlock()
 
     def test_commit_kind_changes(self):
-        if not osutils.has_symlinks():
-            raise tests.TestSkipped('Test requires symlink support')
+        self.requireFeature(SymlinkFeature)
         tree = self.make_branch_and_tree('.')
         os.symlink('target', 'name')
         tree.add('name', 'a-file-id')

=== modified file 'bzrlib/tests/test_commit_merge.py'
--- a/bzrlib/tests/test_commit_merge.py	2007-03-15 23:27:43 +0000
+++ b/bzrlib/tests/test_commit_merge.py	2007-11-01 09:52:45 +0000
@@ -19,8 +19,8 @@
 import shutil
 
 from bzrlib.tests import (
+    SymlinkFeature,
     TestCaseWithTransport,
-    TestSkipped,
     )
 from bzrlib.branch import Branch
 from bzrlib.errors import PointlessCommit, BzrError
@@ -102,8 +102,7 @@
         by.repository.check([by.last_revision()])
 
     def test_merge_with_symlink(self):
-        if not osutils.has_symlinks():
-            raise TestSkipped('Symlinks are not supported on this platform')
+        self.requireFeature(SymlinkFeature)
         tree_a = self.make_branch_and_tree('tree_a')
         os.symlink('target', osutils.pathjoin('tree_a', 'link'))
         tree_a.add('link')

=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2007-10-10 00:07:04 +0000
+++ b/bzrlib/tests/test_dirstate.py	2007-11-01 09:52:45 +0000
@@ -26,11 +26,10 @@
     osutils,
     )
 from bzrlib.memorytree import MemoryTree
-from bzrlib.osutils import has_symlinks
 from bzrlib.tests import (
+        SymlinkFeature,
         TestCase,
         TestCaseWithTransport,
-        TestSkipped,
         )
 
 
@@ -1077,8 +1076,7 @@
         # The most trivial addition of a symlink when there are no parents and
         # its in the root and all data about the file is supplied
         # bzr doesn't support fake symlinks on windows, yet.
-        if not has_symlinks():
-            raise TestSkipped("No symlink support")
+        self.requireFeature(SymlinkFeature)
         os.symlink('target', 'a link')
         stat = os.lstat('a link')
         expected_entries = [
@@ -1598,9 +1596,7 @@
 
     def test_update_entry_symlink(self):
         """Update entry should read symlinks."""
-        if not osutils.has_symlinks():
-            # PlatformDeficiency / TestSkipped
-            raise TestSkipped("No symlink support")
+        self.requireFeature(SymlinkFeature)
         state, entry = self.get_state_with_a()
         state.save()
         self.assertEqual(dirstate.DirState.IN_MEMORY_UNMODIFIED,
@@ -1757,9 +1753,7 @@
 
     def test_update_file_to_symlink(self):
         """File becomes a symlink"""
-        if not osutils.has_symlinks():
-            # PlatformDeficiency / TestSkipped
-            raise TestSkipped("No symlink support")
+        self.requireFeature(SymlinkFeature)
         state, entry = self.get_state_with_a()
         # The file sha1 won't be cached unless the file is old
         state.adjust_time(+10)
@@ -1778,9 +1772,7 @@
 
     def test_update_dir_to_symlink(self):
         """Directory becomes a symlink"""
-        if not osutils.has_symlinks():
-            # PlatformDeficiency / TestSkipped
-            raise TestSkipped("No symlink support")
+        self.requireFeature(SymlinkFeature)
         state, entry = self.get_state_with_a()
         # The symlink target won't be cached if it isn't old
         state.adjust_time(+10)
@@ -1790,8 +1782,7 @@
 
     def test_update_symlink_to_file(self):
         """Symlink becomes a file"""
-        if not has_symlinks():
-            raise TestSkipped("No symlink support")
+        self.requireFeature(SymlinkFeature)
         state, entry = self.get_state_with_a()
         # The symlink and file info won't be cached unless old
         state.adjust_time(+10)
@@ -1801,8 +1792,7 @@
 
     def test_update_symlink_to_dir(self):
         """Symlink becomes a directory"""
-        if not has_symlinks():
-            raise TestSkipped("No symlink support")
+        self.requireFeature(SymlinkFeature)
         state, entry = self.get_state_with_a()
         # The symlink target won't be cached if it isn't old
         state.adjust_time(+10)

=== modified file 'bzrlib/tests/test_hashcache.py'
--- a/bzrlib/tests/test_hashcache.py	2006-09-20 14:03:05 +0000
+++ b/bzrlib/tests/test_hashcache.py	2007-11-02 05:12:17 +0000
@@ -22,7 +22,7 @@
 
 from bzrlib.errors import BzrError
 from bzrlib.hashcache import HashCache
-from bzrlib.tests import TestCaseInTempDir, TestSkipped, TestCase
+from bzrlib.tests import OsFifoFeature, TestCaseInTempDir, TestCase
 
 
 def sha1(t):
@@ -111,9 +111,8 @@
 
     def test_hashcache_raise(self):
         """check that hashcache can raise BzrError"""
+        self.requireFeature(OsFifoFeature)
         hc = self.make_hashcache()
-        if getattr(os, 'mkfifo', None) is None:
-            raise TestSkipped('filesystem fifos not supported on this system')
         os.mkfifo('a')
         # It's possible that the system supports fifos but the filesystem
         # can't.  In that case we should skip at this point.  But in fact

=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2007-07-04 12:28:56 +0000
+++ b/bzrlib/tests/test_http.py	2007-11-02 05:12:17 +0000
@@ -934,13 +934,15 @@
         self.no_proxy_host = 'localhost'
 
     def test_HTTP_PROXY(self):
-        # pycurl do not check HTTP_PROXY for security reasons
+        # pycurl does not check HTTP_PROXY for security reasons
         # (for use in a CGI context that we do not care
         # about. Should we ?)
-        raise TestSkipped()
+        raise TestSkipped('pycurl does not check HTTP_PROXY '
+            'for security reasons')
 
     def test_HTTP_PROXY_with_NO_PROXY(self):
-        raise TestSkipped()
+        raise TestSkipped('pycurl does not check HTTP_PROXY '
+            'for security reasons')
 
     def test_http_proxy_without_scheme(self):
         # pycurl *ignores* invalid proxy env variables. If that

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2007-10-22 16:03:11 +0000
+++ b/bzrlib/tests/test_osutils.py	2007-11-01 09:52:45 +0000
@@ -37,6 +37,7 @@
 from bzrlib.tests import (
         probe_unicode_in_user_encoding,
         StringIOWrapper,
+        SymlinkFeature,
         TestCase,
         TestCaseInTempDir,
         TestSkipped,
@@ -250,8 +251,7 @@
         self.assertFormatedDelta('2 seconds in the future', -2)
 
     def test_dereference_path(self):
-        if not osutils.has_symlinks():
-            raise TestSkipped('Symlinks are not supported on this platform')
+        self.requireFeature(SymlinkFeature)
         cwd = osutils.realpath('.')
         os.mkdir('bar')
         bar_path = osutils.pathjoin(cwd, 'bar')
@@ -937,8 +937,7 @@
         self.assertEqual(['c'], os.listdir('target/b'))
 
     def test_copy_tree_symlinks(self):
-        if not osutils.has_symlinks():
-            return
+        self.requireFeature(SymlinkFeature)
         self.build_tree(['source/'])
         os.symlink('a/generic/path', 'source/lnk')
         osutils.copy_tree('source', 'target')

=== modified file 'bzrlib/tests/test_osutils_encodings.py'
--- a/bzrlib/tests/test_osutils_encodings.py	2007-01-04 23:36:44 +0000
+++ b/bzrlib/tests/test_osutils_encodings.py	2007-11-01 09:52:45 +0000
@@ -29,7 +29,6 @@
 from bzrlib.tests import (
         StringIOWrapper,
         TestCase, 
-        TestSkipped,
         )
 
 

=== modified file 'bzrlib/tests/test_testament.py'
--- a/bzrlib/tests/test_testament.py	2007-03-06 00:28:36 +0000
+++ b/bzrlib/tests/test_testament.py	2007-11-01 09:52:45 +0000
@@ -21,10 +21,9 @@
 import os
 from sha import sha
 
-from bzrlib.tests import TestCaseWithTransport
+from bzrlib.tests import SymlinkFeature, TestCaseWithTransport
 from bzrlib.testament import Testament, StrictTestament, StrictTestament3
 from bzrlib.transform import TreeTransform
-from bzrlib.osutils import has_symlinks
 
 
 class TestamentSetup(TestCaseWithTransport):
@@ -98,8 +97,7 @@
 
     def test_testament_symlinks(self):
         """Testament containing symlink (where possible)"""
-        if not has_symlinks():
-            return
+        self.requireFeature(SymlinkFeature)
         os.symlink('wibble/linktarget', 'link')
         self.wt.add(['link'], ['link-id'])
         self.wt.commit(message='add symlink',

=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2007-09-05 04:35:21 +0000
+++ b/bzrlib/tests/test_transform.py	2007-11-01 09:52:45 +0000
@@ -33,9 +33,14 @@
                            PathsNotVersionedError, ExistingLimbo,
                            ExistingPendingDeletion, ImmortalLimbo,
                            ImmortalPendingDeletion, LockError)
-from bzrlib.osutils import file_kind, has_symlinks, pathjoin
+from bzrlib.osutils import file_kind, pathjoin
 from bzrlib.merge import Merge3Merger
-from bzrlib.tests import TestCaseInTempDir, TestSkipped, TestCase
+from bzrlib.tests import (
+    SymlinkFeature,
+    TestCase,
+    TestCaseInTempDir,
+    TestSkipped,
+    )
 from bzrlib.transform import (TreeTransform, ROOT_PARENT, FinalPaths, 
                               resolve_conflicts, cook_conflicts, 
                               find_interesting, build_tree, get_backup_name,
@@ -385,8 +390,7 @@
         replace.apply()
 
     def test_symlinks(self):
-        if not has_symlinks():
-            raise TestSkipped('Symlinks are not supported on this platform')
+        self.requireFeature(SymlinkFeature)
         transform,root = self.get_transform()
         oz_id = transform.new_directory('oz', root, 'oz-id')
         wizard = transform.new_symlink('wizard', oz_id, 'wizard-target', 
@@ -1055,8 +1059,7 @@
         this.wt.revert()
 
     def test_file_merge(self):
-        if not has_symlinks():
-            raise TestSkipped('Symlinks are not supported on this platform')
+        self.requireFeature(SymlinkFeature)
         root_id = generate_ids.gen_root_id()
         base = TransformGroup("BASE", root_id)
         this = TransformGroup("THIS", root_id)
@@ -1165,8 +1168,7 @@
 class TestBuildTree(tests.TestCaseWithTransport):
 
     def test_build_tree(self):
-        if not has_symlinks():
-            raise TestSkipped('Test requires symlink support')
+        self.requireFeature(SymlinkFeature)
         os.mkdir('a')
         a = BzrDir.create_standalone_workingtree('a')
         os.mkdir('a/foo')
@@ -1220,8 +1222,7 @@
 
     def test_symlink_conflict_handling(self):
         """Ensure that when building trees, conflict handling is done"""
-        if not has_symlinks():
-            raise TestSkipped('Test requires symlink support')
+        self.requireFeature(SymlinkFeature)
         source = self.make_branch_and_tree('source')
         os.symlink('foo', 'source/symlink')
         source.add('symlink', 'new-symlink')

=== modified file 'bzrlib/tests/tree_implementations/test_get_symlink_target.py'
--- a/bzrlib/tests/tree_implementations/test_get_symlink_target.py	2007-02-25 16:56:33 +0000
+++ b/bzrlib/tests/tree_implementations/test_get_symlink_target.py	2007-11-01 09:52:45 +0000
@@ -29,9 +29,7 @@
 class TestGetSymlinkTarget(TestCaseWithTree):
 
     def get_tree_with_symlinks(self):
-        if not osutils.has_symlinks():
-            raise tests.TestSkipped('platform does not support symlinks.')
-
+        self.requireFeature(tests.SymlinkFeature)
         tree = self.make_branch_and_tree('tree')
         os.symlink('foo', 'tree/link')
         os.symlink('../bar', 'tree/rel_link')

=== modified file 'bzrlib/tests/tree_implementations/test_inv.py'
--- a/bzrlib/tests/tree_implementations/test_inv.py	2007-10-16 16:02:01 +0000
+++ b/bzrlib/tests/tree_implementations/test_inv.py	2007-11-01 09:52:45 +0000
@@ -22,11 +22,9 @@
 
 from bzrlib.diff import internal_diff
 from bzrlib.mutabletree import MutableTree
-from bzrlib.osutils import (
-    has_symlinks,
-    )
+from bzrlib.osutils import has_symlinks
 from bzrlib.symbol_versioning import zero_ninetyone
-from bzrlib.tests import TestSkipped
+from bzrlib.tests import SymlinkFeature, TestSkipped
 from bzrlib.tests.tree_implementations import TestCaseWithTree
 from bzrlib.uncommit import uncommit
 
@@ -109,9 +107,9 @@
                           output)
         self.assertEqual(output.getvalue(), 
                          "Binary files /dev/null and new_label differ\n")
+
     def test_link_diff_deleted(self):
-        if not has_symlinks():
-            return
+        self.requireFeature(SymlinkFeature)
         output = StringIO()
         self.link_1.diff(internal_diff, 
                           "old_label", self.tree_1,
@@ -121,8 +119,7 @@
                          "=== target was 'target1'\n")
 
     def test_link_diff_added(self):
-        if not has_symlinks():
-            return
+        self.requireFeature(SymlinkFeature)
         output = StringIO()
         self.link_1.diff(internal_diff, 
                           "new_label", self.tree_1,
@@ -132,8 +129,7 @@
                          "=== target is 'target1'\n")
 
     def test_link_diff_changed(self):
-        if not has_symlinks():
-            return
+        self.requireFeature(SymlinkFeature)
         output = StringIO()
         self.link_1.diff(internal_diff, 
                           "/dev/null", self.tree_1, 
@@ -222,8 +218,7 @@
         self.inv = self.tree.inventory
 
     def test_symlink_target(self):
-        if not has_symlinks():
-            raise TestSkipped('No symlink support')
+        self.requireFeature(SymlinkFeature)
         self._set_up()
         if isinstance(self.tree, MutableTree):
             raise TestSkipped(
@@ -232,8 +227,7 @@
         self.assertEqual(entry.symlink_target, 'link-target')
 
     def test_symlink(self):
-        if not has_symlinks():
-            raise TestSkipped('No symlink support')
+        self.requireFeature(SymlinkFeature)
         self._set_up()
         entry = self.inv[self.inv.path2id('symlink')]
         self.assertEqual(entry.kind, 'symlink')

=== modified file 'bzrlib/tests/tree_implementations/test_test_trees.py'
--- a/bzrlib/tests/tree_implementations/test_test_trees.py	2007-04-14 11:55:51 +0000
+++ b/bzrlib/tests/tree_implementations/test_test_trees.py	2007-11-01 09:52:45 +0000
@@ -16,8 +16,7 @@
 
 """Tests for the test trees used by the tree_implementations tests."""
 
-from bzrlib.osutils import has_symlinks
-from bzrlib.tests import TestSkipped
+from bzrlib.tests import SymlinkFeature
 from bzrlib.tests.tree_implementations import TestCaseWithTree
 
 
@@ -148,8 +147,7 @@
         # currently this test tree requires unicode. It might be good
         # to have it simply stop having the single unicode file in it
         # when dealing with a non-unicode filesystem.
-        if not has_symlinks():
-            raise TestSkipped('No symlink support')
+        self.requireFeature(SymlinkFeature)
         tree = self.get_tree_with_subdirs_and_all_content_types()
         tree.lock_read()
         self.addCleanup(tree.unlock)

=== modified file 'bzrlib/tests/workingtree_implementations/test_commit.py'
--- a/bzrlib/tests/workingtree_implementations/test_commit.py	2007-10-23 21:10:52 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_commit.py	2007-11-01 09:52:45 +0000
@@ -31,8 +31,8 @@
     )
 from bzrlib.errors import (NotBranchError, NotVersionedError, 
                            UnsupportedOperation)
-from bzrlib.osutils import pathjoin, getcwd, has_symlinks
-from bzrlib.tests import TestSkipped, TestCase
+from bzrlib.osutils import pathjoin, getcwd
+from bzrlib.tests import TestCase
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 from bzrlib.trace import mutter
 from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,

=== modified file 'bzrlib/tests/workingtree_implementations/test_pull.py'
--- a/bzrlib/tests/workingtree_implementations/test_pull.py	2006-09-05 08:14:23 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_pull.py	2007-11-01 09:52:45 +0000
@@ -21,7 +21,6 @@
 from bzrlib import errors
 from bzrlib.errors import NotBranchError, NotVersionedError
 from bzrlib.osutils import basename
-from bzrlib.tests import TestSkipped
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 from bzrlib.trace import mutter
 from bzrlib.transport import get_transport

=== modified file 'bzrlib/tests/workingtree_implementations/test_walkdirs.py'
--- a/bzrlib/tests/workingtree_implementations/test_walkdirs.py	2007-04-14 12:17:31 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_walkdirs.py	2007-11-01 09:52:45 +0000
@@ -19,8 +19,7 @@
 import os
 
 from bzrlib import transform
-from bzrlib.osutils import has_symlinks
-from bzrlib.tests import TestSkipped
+from bzrlib.tests import SymlinkFeature
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 
 # tests to write:
@@ -139,8 +138,7 @@
 
     def test_walkdirs_type_changes(self):
         """Walkdir shows the actual kinds on disk and the recorded kinds."""
-        if not has_symlinks():
-            raise TestSkipped('No symlink support')
+        self.requireFeature(SymlinkFeature)
         tree = self.make_branch_and_tree('.')
         paths = ['file1', 'file2', 'dir1/', 'dir2/']
         ids = ['file1', 'file2', 'dir1', 'dir2']

=== modified file 'bzrlib/tests/workingtree_implementations/test_workingtree.py'
--- a/bzrlib/tests/workingtree_implementations/test_workingtree.py	2007-08-29 16:09:51 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_workingtree.py	2007-11-01 09:52:45 +0000
@@ -642,7 +642,7 @@
         try:
             tree.set_conflicts(ConflictList())
         except UnsupportedOperation:
-            raise TestSkipped
+            raise TestSkipped('unsupported operation')
         self.assertEqual(tree.conflicts(), ConflictList())
 
     def test_add_conflicts(self):
@@ -650,7 +650,7 @@
         try:
             tree.add_conflicts([TextConflict('path_a')])
         except UnsupportedOperation:
-            raise TestSkipped()
+            raise TestSkipped('unsupported operation')
         self.assertEqual(ConflictList([TextConflict('path_a')]),
                          tree.conflicts())
         tree.add_conflicts([TextConflict('path_a')])




More information about the bazaar-commits mailing list