subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1743236 - in /subversion/trunk/subversion/tests/cmdline: merge_tests.py svntest/actions.py svntest/tree.py
Date Tue, 10 May 2016 17:16:55 GMT
Author: stefan2
Date: Tue May 10 17:16:55 2016
New Revision: 1743236

URL: http://svn.apache.org/viewvc?rev=1743236&view=rev
Log:
Fix the first merge_test that is broken for Python 3.

* subversion/tests/cmdline/svntest/actions.py
  (set_prop): If we write a bytes string to a prop, treat it as binary
              that can't be passed directly via command line argument.

* subversion/tests/cmdline/svntest/tree.py
  (get_props): Only normalize EOL for non-binary properties.  If we use
               e.g. invalid non-UTF-8 values in our tests, we should not
               modify them in any way.

* subversion/tests/cmdline/svntest/actions.py
  (set_prop): Use the improved set_prop action to handle binary propsets.
              Explicitly mark non-utf8 property contents as binary.

Modified:
    subversion/trunk/subversion/tests/cmdline/merge_tests.py
    subversion/trunk/subversion/tests/cmdline/svntest/actions.py
    subversion/trunk/subversion/tests/cmdline/svntest/tree.py

Modified: subversion/trunk/subversion/tests/cmdline/merge_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/merge_tests.py?rev=1743236&r1=1743235&r2=1743236&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/merge_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/merge_tests.py Tue May 10 17:16:55 2016
@@ -496,16 +496,10 @@ def simple_property_merges(sbox):
   beta_path = sbox.ospath('A/B/E/beta')
   E_path = sbox.ospath('A/B/E')
 
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'foo', 'foo_val',
-                                     alpha_path)
+  svntest.actions.set_prop('foo', 'foo_val', alpha_path)
   # A binary, non-UTF8 property value
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'foo', 'foo\201val',
-                                     beta_path)
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'foo', 'foo_val',
-                                     E_path)
+  svntest.actions.set_prop('foo', b'foo\201val', beta_path)
+  svntest.actions.set_prop('foo', 'foo_val', E_path)
 
   # Commit change as rev 2
   expected_output = svntest.wc.State(wc_dir, {
@@ -530,18 +524,12 @@ def simple_property_merges(sbox):
   svntest.actions.run_and_verify_svn(None, [], 'up', wc_dir)
 
   # Modify a property and add a property for the file and directory
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'foo', 'mod_foo', alpha_path)
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'bar', 'bar_val', alpha_path)
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'foo', 'mod\201foo', beta_path)
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'bar', 'bar\201val', beta_path)
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'foo', 'mod_foo', E_path)
-  svntest.actions.run_and_verify_svn(None, [],
-                                     'propset', 'bar', 'bar_val', E_path)
+  svntest.actions.set_prop('foo', 'mod_foo', alpha_path)
+  svntest.actions.set_prop('bar', 'bar_val', alpha_path)
+  svntest.actions.set_prop('foo', b'mod\201foo', beta_path)
+  svntest.actions.set_prop('bar', b'bar\201val', beta_path)
+  svntest.actions.set_prop('foo', 'mod_foo', E_path)
+  svntest.actions.set_prop('bar', 'bar_val', E_path)
 
   # Commit change as rev 4
   expected_status = svntest.actions.get_virginal_state(wc_dir, 3)
@@ -585,7 +573,7 @@ def simple_property_merges(sbox):
   expected_disk.tweak('E', 'E/alpha',
                       props={'foo' : 'mod_foo', 'bar' : 'bar_val'})
   expected_disk.tweak('E/beta',
-                      props={'foo' : 'mod\201foo', 'bar' : 'bar\201val'})
+                      props={'foo' : b'mod\201foo', 'bar' : b'bar\201val'})
   expected_status = wc.State(B2_path, {
     ''        : Item(status=' M'),
     'E'       : Item(status=' M'),
@@ -645,7 +633,7 @@ def simple_property_merges(sbox):
     : Item(error_message('foo', 'foo?\\81val', 'mod?\\81foo')),
     })
   expected_disk.tweak('E', 'E/alpha', props={'bar' : 'bar_val'})
-  expected_disk.tweak('E/beta', props={'bar' : 'bar\201val'})
+  expected_disk.tweak('E/beta', props={'bar' : b'bar\201val'})
   expected_status.tweak('', status=' M')
   expected_status.tweak('E', 'E/alpha', 'E/beta', status=' C')
   expected_output.tweak('E', 'E/alpha', 'E/beta', status=' C')

Modified: subversion/trunk/subversion/tests/cmdline/svntest/actions.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/actions.py?rev=1743236&r1=1743235&r2=1743236&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/actions.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/actions.py Tue May 10 17:16:55 2016
@@ -2021,7 +2021,8 @@ def set_prop(name, value, path, expected
     propset = ('propset',)
   else:
     propset = ('propset', '--force')
-  if value and (value[0] == '-' or '\x00' in value or sys.platform == 'win32'):
+  if value and (isinstance(value, bytes) or
+                (value[0] == '-' or '\x00' in value or sys.platform == 'win32')):
     from tempfile import mkstemp
     (fd, value_file_path) = mkstemp()
     os.close(fd)

Modified: subversion/trunk/subversion/tests/cmdline/svntest/tree.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/tree.py?rev=1743236&r1=1743235&r2=1743236&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/tree.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/tree.py Tue May 10 17:16:55 2016
@@ -544,7 +544,8 @@ def get_props(paths):
       # contains a CR character XML-encoded as '
'.  The XML
       # parser converts it back into a CR character.  So again convert
       # all end-of-line variants into a single LF:
-      value = eol_re.sub('\n', value)
+      if isinstance(value, str):
+        value = eol_re.sub('\n', value)
       file_props[name] = value
     files[filename] = file_props
 



Mime
View raw message