Rev 3478: Move UnicodeFeature into a core 'tests' feature, rather than living in test_diff. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/symlink_unicode_135320

John Arbash Meinel john at arbash-meinel.com
Thu Jun 5 22:07:00 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/symlink_unicode_135320

------------------------------------------------------------
revno: 3478
revision-id: john at arbash-meinel.com-20080605210642-zoc3nelx84xmsxuf
parent: pqm at pqm.ubuntu.com-20080605191237-2306x0goo9pfh9to
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: symlink_unicode_135320
timestamp: Thu 2008-06-05 16:06:42 -0500
message:
  Move UnicodeFeature into a core 'tests' feature, rather than living in test_diff.
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2008-06-04 05:59:16 +0000
+++ b/bzrlib/tests/__init__.py	2008-06-05 21:06:42 +0000
@@ -3062,6 +3062,26 @@
 OsFifoFeature = _OsFifoFeature()
 
 
+class _UnicodeFilename(Feature):
+    """Does the filesystem support Unicode filenames?"""
+
+    def _probe(self):
+        try:
+            os.stat(u'\u03b1')
+        except UnicodeEncodeError:
+            return False
+        except (IOError, OSError):
+            # The filesystem allows the Unicode filename but the file doesn't
+            # exist.
+            return True
+        else:
+            # The filesystem allows the Unicode filename and the file exists,
+            # for some reason.
+            return True
+
+UnicodeFilename = _UnicodeFilename()
+
+
 class TestScenarioApplier(object):
     """A tool to apply scenarios to tests."""
 

=== modified file 'bzrlib/tests/test_diff.py'
--- a/bzrlib/tests/test_diff.py	2008-03-13 23:22:12 +0000
+++ b/bzrlib/tests/test_diff.py	2008-06-05 21:06:42 +0000
@@ -56,35 +56,6 @@
 CompiledPatienceDiffFeature = _CompiledPatienceDiffFeature()
 
 
-class _UnicodeFilename(Feature):
-    """Does the filesystem support Unicode filenames?"""
-
-    def _probe(self):
-        try:
-            os.stat(u'\u03b1')
-        except UnicodeEncodeError:
-            return False
-        except (IOError, OSError):
-            # The filesystem allows the Unicode filename but the file doesn't
-            # exist.
-            return True
-        else:
-            # The filesystem allows the Unicode filename and the file exists,
-            # for some reason.
-            return True
-
-UnicodeFilename = _UnicodeFilename()
-
-
-class TestUnicodeFilename(TestCase):
-
-    def test_probe_passes(self):
-        """UnicodeFilename._probe passes."""
-        # We can't test much more than that because the behaviour depends
-        # on the platform.
-        UnicodeFilename._probe()
-        
-
 def udiff_lines(old, new, allow_binary=False):
     output = StringIO()
     internal_diff('old', old, 'new', new, output, allow_binary)
@@ -548,7 +519,7 @@
         is a binary file in the diff.
         """
         # See https://bugs.launchpad.net/bugs/110092.
-        self.requireFeature(UnicodeFilename)
+        self.requireFeature(tests.UnicodeFilename)
 
         # This bug isn't triggered with cStringIO.
         from StringIO import StringIO
@@ -573,7 +544,7 @@
 
     def test_unicode_filename(self):
         """Test when the filename are unicode."""
-        self.requireFeature(UnicodeFilename)
+        self.requireFeature(tests.UnicodeFilename)
 
         alpha, omega = u'\u03b1', u'\u03c9'
         autf8, outf8 = alpha.encode('utf8'), omega.encode('utf8')

=== modified file 'bzrlib/tests/test_msgeditor.py'
--- a/bzrlib/tests/test_msgeditor.py	2007-12-19 08:12:34 +0000
+++ b/bzrlib/tests/test_msgeditor.py	2008-06-05 21:06:42 +0000
@@ -25,6 +25,7 @@
     errors,
     msgeditor,
     osutils,
+    tests,
     )
 from bzrlib.branch import Branch
 from bzrlib.config import ensure_config_dir_exists, config_filename
@@ -257,8 +258,7 @@
         self.assertFileEqual(expected, msgfilename)
 
     def test__create_temp_file_with_commit_template_in_unicode_dir(self):
-        from bzrlib.tests.test_diff import UnicodeFilename
-        self.requireFeature(UnicodeFilename)
+        self.requireFeature(tests.UnicodeFilename)
         if hasattr(self, 'info'):
             os.mkdir(self.info['directory'])
             os.chdir(self.info['directory'])

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2008-05-29 09:48:47 +0000
+++ b/bzrlib/tests/test_selftest.py	2008-06-05 21:06:42 +0000
@@ -1049,6 +1049,15 @@
         self.assertEqual(None, result._extractBenchmarkTime(test))
 
 
+class TestUnicodeFilenameFeature(TestCase):
+
+    def test_probe_passes(self):
+        """UnicodeFilename._probe passes."""
+        # We can't test much more than that because the behaviour depends
+        # on the platform.
+        tests.UnicodeFilename._probe()
+
+
 class TestRunner(TestCase):
 
     def dummy_test(self):



More information about the bazaar-commits mailing list