Author: troycurtisjr
Date: Mon Nov 6 01:58:20 2017
New Revision: 1814386
URL: http://svn.apache.org/viewvc?rev=1814386&view=rev
Log:
On branch swig-py3: Update swig python code to be compatible with both Python 2
and Python3.
Change non-generated python code to use syntax that is valid for both Python 3
and Python 2.7. Where this is not possible, provide compatibility wrappers.
Python 2 unit tests all pass after the changes, but more effort remains for full
Python 3 functionality.
* build/generator/swig/header_wrappers.py
(_write_swig_interface_file): For Python3, include an encoding argument to
tempfile.TemporaryFile()
* build/generator/util/executable.py
(output): Ensure the subprocess' output is interpreted as utf8 for proper
Python 3 compatibility.
[in subversion/bindings/swig/python]
* svn/core.py
Import the builtin 'list' as '_bi_list' to aid in compatibility in other
modules.
(_unprefix_names): Wrap dict.items() in list() for py2.7/3 support.
(__all__): Change filter() to list comprehension for py2.7/3 support.
* svn/client.py
svn/delta.py
svn/diff.py
svn/fs.py
svn/ra.py
svn/repos.py
svn/wc.py
(__all__): Change filter() to list comprehension for py2.7/3 support. Use the
_bi_list to provide a new list instance of locals on both Python 2.7 and 3.
* svn/fs.py
(entries): Wrap dict.items() in _bi_list() for py2.7/3 support.
* tests/auth.py
(test_open): Change deprecated assert_ to assertTrue.
(test_credentials_get_username,
test_credentials_get_simple,
test_credentials_get_ssl_client_cert,
test_credentials_get_ssl_client_cert_pw,
test_credentials_get_ssl_server_trust):
Change deprecated assertEquals to assertEqual and assert_ to assertTrue.
* tests/client.py
(setUp, test_log5, proplist_receiver_trunk, proplist_receiver_dir1,
test_inherited_props, test_update4):
Change deprecated assertEquals to assertEqual.
(testBatonPlay): Change deprecated assertEquals to assertEqual and
assertNotEquals to assertNotEqual.
(test_log3_url, test_platform_providers):
Change deprecated assert_ to assertTrue.
(test_log5): Change deprecated assert_ to assertTrue and assertEquals to
assertEqual.
* tests/core.py
(test_config_enumerate2): Replace dict.iteritems() with dict.items() to be
compatible with py2.7/3. Change deprecated assert_ to assertTrue.
(test_config_enumerate_sections2): Change deprecated assert_ to assertTrue.
* tests/delta.py
(testTxdeltaWindowT): Change deprecated assert_ to assertTrue.
* tests/mergeinfo.py
(test_rangelist_reverse,
test_mergeinfo_leakage__incorrect_range_t_refcounts,
test_mergeinfo_leakage__lingering_range_t_objects_after_del,
inspect_mergeinfo_dict):
Change deprecated assertEquals to assertEqual.
(test_mergeinfo_leakage__incorrect_range_t_refcounts): Wrap dict.items() in
list() for py2.7/3 support. Change deprecated assertEquals to assertEqual.
(inspect_mergeinfo_dict): Change deprecated assert_ to assertTrue.
(compare_mergeinfo_catalogs,
compare_mergeinfos):
Drop usage of dict.keys() for py2.7/3 support.
* tests/ra.py
(test_get_dir2, test_delta_driver_commit, test_get_file_revs,
test_lock, test_get_log2, test_namestring):
Change deprecated assert_ to assertTrue.
(test_delta_driver_commit): Wrap dict.items() in list() for py2.7/3 support.
* tests/repository.py
(test_dump_fs2): Change deprecated assertEquals to assertEqual.
(test_get_logs): Wrap dict.values() in list() for py2.7/3 support.
* tests/run_all.py
(suite): Do not use long() cast when running with Python 3.
* tests/utils.py
Support correct import of StringIO and pathname2url from Python 2.7 and 3.
(file_uri_for_path): Use unqualified pathname2url to support py2.7/3.
* tests/wc.py
(test_is_adm_dir, test_set_adm_dir, test_status_editor,
test_is_normal_prop, test_is_wc_prop, test_is_entry_prop):
Change deprecated assert_ to assertTrue and failIf to assertFalse.
(test_get_adm_dir, test_crawl_revisions2, test_check_wc, test_get_prop_diffs,
test_get_ignores):
Change deprecated assert_ with assertTrue.
(test_commit): Change deprecated assertEquals to assertEqual.
(test_diff_editor4): Wrap dict.items() in list() for py2.7/3 support.
* tests/trac/versioncontrol/svn_fs.py
(get_entries): Drop usage of dict.keys() for py2.7/3 support.
(get_properties, get_changes): Wrap dict.items() with list() for py2.7/3
support.
* tests/trac/versioncontrol/tests/svn_fs.py
Support correct import of StringIO and pathname2url from Python 2.7 and 3.
(test_get_dir_entries, test_get_file_entries, test_get_node_history,
test_get_node_history_follow_copy, test_get_path_history,
test_get_path_history_copied_file, test_get_path_history_copied_dir,
test_changeset_added_dirs, test_changeset_file_edit, test_changset_dir_moves,
test_changeset_file_copy):
Replace the series of direct calls to .next() with assertSequenceEqual for
py2.7/3 support.
(test_diff_file_different_revs, test_diff_file_different_files,
test_diff_file_no_change, test_diff_dir_different_revs,
test_diff_dir_different_dirs, test_diff_dir_no_change,
test_changeset_repos_creation):
Replace <iter>.next() with next(<iter>) for py2.7/3 support.
Modified:
subversion/branches/swig-py3/build/generator/swig/header_wrappers.py
subversion/branches/swig-py3/build/generator/util/executable.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/client.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/core.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/delta.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/diff.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/ra.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/repos.py
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/wc.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/auth.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/client.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/core.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/delta.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/mergeinfo.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/ra.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/repository.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/run_all.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/svn_fs.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/wc.py
Modified: subversion/branches/swig-py3/build/generator/swig/header_wrappers.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/build/generator/swig/header_wrappers.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/build/generator/swig/header_wrappers.py
(original)
+++ subversion/branches/swig-py3/build/generator/swig/header_wrappers.py Mon
Nov 6 01:58:20 2017
@@ -265,7 +265,13 @@ class Generator(generator.swig.Generator
self.proxy_filename(base_fname))
# Open a temporary output file
- self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir)
+ if sys.version_info[0] >= 3:
+ self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir,
+ mode="w+",
+ encoding="utf8")
+ else:
+ self.ofile = tempfile.TemporaryFile(dir=self.proxy_dir)
+
self.ofile.write('/* Proxy classes for %s\n' % base_fname)
self.ofile.write(' * DO NOT EDIT -- AUTOMATICALLY GENERATED\n')
self.ofile.write(' * BY build/generator/swig/header_wrappers.py */\n')
Modified: subversion/branches/swig-py3/build/generator/util/executable.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/build/generator/util/executable.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/build/generator/util/executable.py (original)
+++ subversion/branches/swig-py3/build/generator/util/executable.py Mon Nov 6
01:58:20 2017
@@ -56,6 +56,7 @@ def output(cmd, strip=None):
# Run it
(output, empty_stderr) = subprocess.Popen(cmd, stdout=subprocess.PIPE, \
stderr=subprocess.STDOUT).communicate()
+ output = output.decode('utf8')
if strip:
return output.strip()
else:
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/client.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/client.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/client.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/client.py
Mon Nov 6 01:58:20 2017
@@ -24,8 +24,9 @@
######################################################################
from libsvn.client import *
-from svn.core import _unprefix_names
+from svn.core import _unprefix_names, _bi_list
_unprefix_names(locals(), 'svn_client_')
_unprefix_names(locals(), 'SVN_CLIENT_')
-__all__ = filter(lambda x: x.lower().startswith('svn_'), locals().keys())
+__all__ = [x for x in _bi_list(locals()) if x.lower().startswith('svn_')]
del _unprefix_names
+del _bi_list
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/core.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/core.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/core.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/core.py
Mon Nov 6 01:58:20 2017
@@ -27,8 +27,19 @@ from libsvn.core import *
import libsvn.core as _libsvncore
import atexit as _atexit
import sys
-# __all__ is defined later, since some svn_* functions are implemented below.
+# Many of the subversion modules unprefix their names to make
+# the exported methods more natural. Several have 'list' which
+# conflicts with the builtin 'list'. Put all the python 2/3
+# conditional import here to reduce code in the other modules
+try:
+ # Python >= 3.0
+ from builtins import list as _bi_list
+except ImportError:
+ # Python < 3.0
+ from __builtin__ import list as _bi_list
+
+# __all__ is defined later, since some svn_* functions are implemented below.
class SubversionException(Exception):
@@ -96,7 +107,7 @@ def _cleanup_application_pool():
_atexit.register(_cleanup_application_pool)
def _unprefix_names(symbol_dict, from_prefix, to_prefix = ''):
- for name, value in symbol_dict.items():
+ for name, value in list(symbol_dict.items()):
if name.startswith(from_prefix):
symbol_dict[to_prefix + name[len(from_prefix):]] = value
@@ -319,10 +330,10 @@ def run_app(func, *args, **kw):
# 'run_app'
# 'svn_relpath__internal_style' 'svn_uri__is_ancestor'
# 'svn_tristate__from_word' 'svn_tristate__to_word'
-__all__ = filter(lambda s: (s.startswith('svn_')
- or s.startswith('SVN_')
- or s.startswith('SVNSYNC_')
- or s in ('Pool', 'SubversionException'))
- and '__' not in s,
- locals())
+__all__ = [s for s in _bi_list(locals())
+ if (s.startswith('svn_')
+ or s.startswith('SVN_')
+ or s.startswith('SVNSYNC_')
+ or s in ('Pool', 'SubversionException'))
+ and '__' not in s]
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/delta.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/delta.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/delta.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/delta.py
Mon Nov 6 01:58:20 2017
@@ -24,11 +24,12 @@
######################################################################
from libsvn.delta import *
-from svn.core import _unprefix_names
+from svn.core import _unprefix_names, _bi_list
_unprefix_names(locals(), 'svn_delta_')
_unprefix_names(locals(), 'svn_txdelta_', 'tx_')
-__all__ = filter(lambda x: x.lower().startswith('svn_'), locals().keys())
+__all__ = [x for x in _bi_list(locals()) if x.lower().startswith('svn_')]
del _unprefix_names
+del _bi_list
class Editor:
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/diff.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/diff.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/diff.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/diff.py
Mon Nov 6 01:58:20 2017
@@ -24,7 +24,8 @@
######################################################################
from libsvn.diff import *
-from svn.core import _unprefix_names
+from svn.core import _unprefix_names, _bi_list
_unprefix_names(locals(), 'svn_diff_')
-__all__ = filter(lambda x: x.lower().startswith('svn_'), locals().keys())
+__all__ = [x for x in _bi_list(locals()) if x.lower().startswith('svn_')]
del _unprefix_names
+del _bi_list
Modified: subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/fs.py Mon
Nov 6 01:58:20 2017
@@ -27,7 +27,7 @@ from libsvn.fs import *
from svn.core import _unprefix_names, Pool
_unprefix_names(locals(), 'svn_fs_')
_unprefix_names(locals(), 'SVN_FS_')
-__all__ = filter(lambda x: x.lower().startswith('svn_'), locals().keys())
+__all__ = [x for x in list(locals()) if x.lower().startswith('svn_')]
del _unprefix_names
@@ -45,7 +45,7 @@ import svn.core as _svncore
def entries(root, path, pool=None):
"Call dir_entries returning a dictionary mappings names to IDs."
e = dir_entries(root, path, pool)
- for name, entry in e.items():
+ for name, entry in list(e.items()):
e[name] = dirent_t_id_get(entry)
return e
Modified: subversion/branches/swig-py3/subversion/bindings/swig/python/svn/ra.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/ra.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/ra.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/ra.py Mon
Nov 6 01:58:20 2017
@@ -24,11 +24,12 @@
######################################################################
from libsvn.ra import *
-from svn.core import _unprefix_names
+from svn.core import _unprefix_names, _bi_list
_unprefix_names(locals(), 'svn_ra_')
_unprefix_names(locals(), 'SVN_RA_')
-__all__ = filter(lambda x: x.lower().startswith('svn_'), locals().keys())
+__all__ = [x for x in _bi_list(locals()) if x.lower().startswith('svn_')]
del _unprefix_names
+del _bi_list
class Callbacks:
"""Base class for callbacks structure for svn.ra.open2.
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/svn/repos.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/repos.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/repos.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/repos.py
Mon Nov 6 01:58:20 2017
@@ -24,11 +24,12 @@
######################################################################
from libsvn.repos import *
-from svn.core import _unprefix_names, Pool
+from svn.core import _unprefix_names, Pool, _bi_list
_unprefix_names(locals(), 'svn_repos_')
_unprefix_names(locals(), 'SVN_REPOS_')
-__all__ = filter(lambda x: x.lower().startswith('svn_'), locals().keys())
+__all__ = [x for x in _bi_list(locals()) if x.lower().startswith('svn_')]
del _unprefix_names
+del _bi_list
# Names that are not to be exported
Modified: subversion/branches/swig-py3/subversion/bindings/swig/python/svn/wc.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/svn/wc.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/svn/wc.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/svn/wc.py Mon
Nov 6 01:58:20 2017
@@ -24,11 +24,12 @@
######################################################################
from libsvn.wc import *
-from svn.core import _unprefix_names
+from svn.core import _unprefix_names, _bi_list
_unprefix_names(locals(), 'svn_wc_')
_unprefix_names(locals(), 'SVN_WC_')
-__all__ = filter(lambda x: x.lower().startswith('svn_'), locals().keys())
+__all__ = [x for x in _bi_list(locals()) if x.lower().startswith('svn_')]
del _unprefix_names
+del _bi_list
class DiffCallbacks2:
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/auth.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/auth.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/auth.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/auth.py
Mon Nov 6 01:58:20 2017
@@ -27,7 +27,7 @@ class SubversionAuthTestCase(unittest.Te
def test_open(self):
baton = core.svn_auth_open([])
- self.assert_(baton is not None)
+ self.assertTrue(baton is not None)
def test_set_parameter(self):
baton = core.svn_auth_open([])
@@ -45,7 +45,7 @@ class SubversionAuthTestCase(unittest.Te
def test_credentials_get_username(self):
def myfunc(realm, maysave, pool):
- self.assertEquals("somerealm", realm)
+ self.assertEqual("somerealm", realm)
username_cred = core.svn_auth_cred_username_t()
username_cred.username = "bar"
username_cred.may_save = False
@@ -53,11 +53,11 @@ class SubversionAuthTestCase(unittest.Te
baton =
core.svn_auth_open([core.svn_auth_get_username_prompt_provider(myfunc, 1)])
creds = core.svn_auth_first_credentials(
core.SVN_AUTH_CRED_USERNAME, "somerealm", baton)
- self.assert_(creds is not None)
+ self.assertTrue(creds is not None)
def test_credentials_get_simple(self):
def myfunc(realm, username, may_save, pool):
- self.assertEquals("somerealm", realm)
+ self.assertEqual("somerealm", realm)
simple_cred = core.svn_auth_cred_simple_t()
simple_cred.username = "mijnnaam"
simple_cred.password = "geheim"
@@ -66,11 +66,11 @@ class SubversionAuthTestCase(unittest.Te
baton =
core.svn_auth_open([core.svn_auth_get_simple_prompt_provider(myfunc, 1)])
creds = core.svn_auth_first_credentials(
core.SVN_AUTH_CRED_SIMPLE, "somerealm", baton)
- self.assert_(creds is not None)
+ self.assertTrue(creds is not None)
def test_credentials_get_ssl_client_cert(self):
def myfunc(realm, may_save, pool):
- self.assertEquals("somerealm", realm)
+ self.assertEqual("somerealm", realm)
ssl_cred = core.svn_auth_cred_ssl_client_cert_t()
ssl_cred.cert_file = "my-certs-file"
ssl_cred.may_save = False
@@ -78,11 +78,11 @@ class SubversionAuthTestCase(unittest.Te
baton =
core.svn_auth_open([core.svn_auth_get_ssl_client_cert_prompt_provider(myfunc,
1)])
creds = core.svn_auth_first_credentials(
core.SVN_AUTH_CRED_SSL_CLIENT_CERT, "somerealm", baton)
- self.assert_(creds is not None)
+ self.assertTrue(creds is not None)
def test_credentials_get_ssl_client_cert_pw(self):
def myfunc(realm, may_save, pool):
- self.assertEquals("somerealm", realm)
+ self.assertEqual("somerealm", realm)
ssl_cred_pw = core.svn_auth_cred_ssl_client_cert_pw_t()
ssl_cred_pw.password = "supergeheim"
ssl_cred_pw.may_save = False
@@ -90,11 +90,11 @@ class SubversionAuthTestCase(unittest.Te
baton =
core.svn_auth_open([core.svn_auth_get_ssl_client_cert_pw_prompt_provider(myfunc,
1)])
creds = core.svn_auth_first_credentials(
core.SVN_AUTH_CRED_SSL_CLIENT_CERT_PW, "somerealm", baton)
- self.assert_(creds is not None)
+ self.assertTrue(creds is not None)
def test_credentials_get_ssl_server_trust(self):
def myfunc(realm, failures, cert_info, may_save, pool):
- self.assertEquals("somerealm", realm)
+ self.assertEqual("somerealm", realm)
ssl_trust = core.svn_auth_cred_ssl_server_trust_t()
ssl_trust.accepted_failures = 0
ssl_trust.may_save = False
@@ -107,7 +107,7 @@ class SubversionAuthTestCase(unittest.Te
cert_info)
creds = core.svn_auth_first_credentials(
core.SVN_AUTH_CRED_SSL_SERVER_TRUST, "somerealm", baton)
- self.assert_(creds is not None)
+ self.assertTrue(creds is not None)
def suite():
return unittest.defaultTestLoader.loadTestsFromTestCase(
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/client.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/client.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
---
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/client.py
(original)
+++
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/client.py
Mon Nov 6 01:58:20 2017
@@ -50,10 +50,10 @@ class SubversionClientTestCase(unittest.
def setUp(self):
"""Set up authentication and client context"""
self.client_ctx = client.svn_client_create_context()
- self.assertEquals(self.client_ctx.log_msg_baton2, None)
- self.assertEquals(self.client_ctx.log_msg_func2, None)
- self.assertEquals(self.client_ctx.log_msg_baton3, None)
- self.assertEquals(self.client_ctx.log_msg_func3, None)
+ self.assertEqual(self.client_ctx.log_msg_baton2, None)
+ self.assertEqual(self.client_ctx.log_msg_func2, None)
+ self.assertEqual(self.client_ctx.log_msg_baton3, None)
+ self.assertEqual(self.client_ctx.log_msg_func3, None)
self.client_ctx.log_msg_func3 = client.svn_swig_py_get_commit_log_func
self.client_ctx.log_msg_baton3 = self.log_message_func
self.log_message_func_calls = 0
@@ -84,22 +84,22 @@ class SubversionClientTestCase(unittest.
weakref_baton = weakref.ref(baton)
self.client_ctx.log_msg_baton2 = baton
baton = None
- self.assertEquals(self.client_ctx.log_msg_baton2(), 1)
- self.assertEquals(weakref_baton()(), 1)
+ self.assertEqual(self.client_ctx.log_msg_baton2(), 1)
+ self.assertEqual(weakref_baton()(), 1)
self.client_ctx.log_msg_baton2 = None
- self.assertEquals(self.client_ctx.log_msg_baton2, None)
- self.assertEquals(weakref_baton(), None)
+ self.assertEqual(self.client_ctx.log_msg_baton2, None)
+ self.assertEqual(weakref_baton(), None)
# External objects should retain their current parent pool
- self.assertNotEquals(self.client_ctx._parent_pool,
+ self.assertNotEqual(self.client_ctx._parent_pool,
self.client_ctx.auth_baton._parent_pool)
# notify_func2 and notify_baton2 were generated by
# svn_client_create_context, so they should have
# the same pool as the context
- self.assertEquals(self.client_ctx._parent_pool,
+ self.assertEqual(self.client_ctx._parent_pool,
self.client_ctx.notify_func2._parent_pool)
- self.assertEquals(self.client_ctx._parent_pool,
+ self.assertEqual(self.client_ctx._parent_pool,
self.client_ctx.notify_baton2._parent_pool)
def testMethodCalls(self):
@@ -214,7 +214,7 @@ class SubversionClientTestCase(unittest.
self.assertEqual(self.log_message, "More directories.")
self.assertEqual(len(self.changed_paths), 3)
for dir in ('/trunk/dir1', '/trunk/dir2', '/trunk/dir3'):
- self.assert_(dir in self.changed_paths)
+ self.assertTrue(dir in self.changed_paths)
self.assertEqual(self.changed_paths[dir].action, 'A')
def test_log5(self):
@@ -236,17 +236,17 @@ class SubversionClientTestCase(unittest.
client.log5((self.repos_uri,), end, (rev_range,), 0, False, True, False,
(),
self.log_entry_receiver, self.client_ctx)
- self.assertEqual(self.received_revisions, range(0, 5))
+ self.assertEqual(self.received_revisions, list(range(0, 5)))
def test_uuid_from_url(self):
"""Test svn_client_uuid_from_url on a file:// URL"""
- self.assert_(isinstance(
+ self.assertTrue(isinstance(
client.uuid_from_url(self.repos_uri, self.client_ctx),
- basestring))
+ str))
def test_url_from_path(self):
"""Test svn_client_url_from_path for a file:// URL"""
- self.assertEquals(client.url_from_path(self.repos_uri), self.repos_uri)
+ self.assertEqual(client.url_from_path(self.repos_uri), self.repos_uri)
rev = core.svn_opt_revision_t()
rev.kind = core.svn_opt_revision_head
@@ -256,7 +256,7 @@ class SubversionClientTestCase(unittest.
client.checkout2(self.repos_uri, path, rev, rev, True, True,
self.client_ctx)
- self.assertEquals(client.url_from_path(path), self.repos_uri)
+ self.assertEqual(client.url_from_path(path), self.repos_uri)
def test_uuid_from_path(self):
"""Test svn_client_uuid_from_path."""
@@ -270,11 +270,11 @@ class SubversionClientTestCase(unittest.
wc_adm = wc.adm_open3(None, path, False, 0, None)
- self.assertEquals(client.uuid_from_path(path, wc_adm, self.client_ctx),
+ self.assertEqual(client.uuid_from_path(path, wc_adm, self.client_ctx),
client.uuid_from_url(self.repos_uri, self.client_ctx))
- self.assert_(isinstance(client.uuid_from_path(path, wc_adm,
- self.client_ctx), basestring))
+ self.assertTrue(isinstance(client.uuid_from_path(path, wc_adm,
+ self.client_ctx), str))
def test_open_ra_session(self):
"""Test svn_client_open_ra_session()."""
@@ -377,10 +377,8 @@ class SubversionClientTestCase(unittest.
def test_platform_providers(self):
providers = core.svn_auth_get_platform_specific_client_providers(None,
None)
# Not much more we can test in this minimal environment.
- self.assert_(isinstance(providers, list))
- self.assert_(not filter(lambda x:
- not isinstance(x,
core.svn_auth_provider_object_t),
- providers))
+ self.assertTrue(isinstance(providers, list))
+ self.assertTrue(not [x for x in providers if not isinstance(x,
core.svn_auth_provider_object_t)])
def testGnomeKeyring(self):
if not hasattr(core, 'svn_auth_set_gnome_keyring_unlock_prompt_func'):
@@ -398,11 +396,11 @@ class SubversionClientTestCase(unittest.
core.svn_auth_set_gnome_keyring_unlock_prompt_func(self.client_ctx.auth_baton,
prompt_func)
def proplist_receiver_trunk(self, path, props, iprops, pool):
- self.assertEquals(props['svn:global-ignores'], '*.q\n')
+ self.assertEqual(props['svn:global-ignores'], '*.q\n')
self.proplist_receiver_trunk_calls += 1
def proplist_receiver_dir1(self, path, props, iprops, pool):
- self.assertEquals(iprops[self.proplist_receiver_dir1_key],
+ self.assertEqual(iprops[self.proplist_receiver_dir1_key],
{'svn:global-ignores':'*.q\n'})
self.proplist_receiver_dir1_calls += 1
@@ -418,24 +416,24 @@ class SubversionClientTestCase(unittest.
props, iprops, rev = client.propget5('svn:global-ignores', trunk_url,
head, head, core.svn_depth_infinity,
None, self.client_ctx)
- self.assertEquals(props[trunk_url], '*.q\n')
+ self.assertEqual(props[trunk_url], '*.q\n')
dir1_url = trunk_url + '/dir1'
props, iprops, rev = client.propget5('svn:global-ignores', dir1_url,
head, head, core.svn_depth_infinity,
None, self.client_ctx)
- self.assertEquals(iprops[trunk_url], {'svn:global-ignores':'*.q\n'})
+ self.assertEqual(iprops[trunk_url], {'svn:global-ignores':'*.q\n'})
self.proplist_receiver_trunk_calls = 0
client.proplist4(trunk_url, head, head, core.svn_depth_empty, None, True,
self.proplist_receiver_trunk, self.client_ctx)
- self.assertEquals(self.proplist_receiver_trunk_calls, 1)
+ self.assertEqual(self.proplist_receiver_trunk_calls, 1)
self.proplist_receiver_dir1_calls = 0
self.proplist_receiver_dir1_key = trunk_url
client.proplist4(dir1_url, head, head, core.svn_depth_empty, None, True,
self.proplist_receiver_dir1, self.client_ctx)
- self.assertEquals(self.proplist_receiver_dir1_calls, 1)
+ self.assertEqual(self.proplist_receiver_dir1_calls, 1)
def test_update4(self):
"""Test update and the notify function callbacks"""
@@ -476,7 +474,7 @@ class SubversionClientTestCase(unittest.
self.notified_paths.sort()
expected_paths.sort()
- self.assertEquals(self.notified_paths, expected_paths)
+ self.assertEqual(self.notified_paths, expected_paths)
def notify_func2(notify, pool):
self.notified_paths.append(notify.path)
@@ -497,7 +495,7 @@ class SubversionClientTestCase(unittest.
False, False, self.client_ctx)
self.notified_paths.sort()
expected_paths.sort()
- self.assertEquals(self.notified_paths, expected_paths)
+ self.assertEqual(self.notified_paths, expected_paths)
def suite():
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/core.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/core.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/core.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/core.py
Mon Nov 6 01:58:20 2017
@@ -23,6 +23,7 @@ import unittest
import svn.core, svn.client
import utils
+
class SubversionCoreTestCase(unittest.TestCase):
"""Test cases for the basic SWIG Subversion core"""
@@ -113,7 +114,7 @@ class SubversionCoreTestCase(unittest.Te
'three': 'three-value'
}
- for (name, value) in entries.iteritems():
+ for (name, value) in entries.items():
svn.core.svn_config_set(cfg, "section", name, value)
received_entries = {}
@@ -124,8 +125,8 @@ class SubversionCoreTestCase(unittest.Te
svn.core.svn_config_enumerate2(cfg, "section", enumerator)
self.assertEqual(len(received_entries), 2)
- for (name, value) in received_entries.iteritems():
- self.assert_(name in entries)
+ for (name, value) in received_entries.items():
+ self.assertTrue(name in entries)
self.assertEqual(value, entries[name])
def test_config_enumerate2_exception(self):
@@ -156,7 +157,7 @@ class SubversionCoreTestCase(unittest.Te
self.assertEqual(len(received_sections), 2)
for section in received_sections:
- self.assert_(section in sections)
+ self.assertTrue(section in sections)
def test_config_enumerate_sections2_exception(self):
cfg = svn.core.svn_config_create(False)
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/delta.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/delta.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/delta.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/delta.py
Mon Nov 6 01:58:20 2017
@@ -55,9 +55,9 @@ class DeltaTestCase(unittest.TestCase):
delta_stream = svn.delta.svn_txdelta(a, b)
window = svn.delta.svn_txdelta_next_window(delta_stream)
- self.assert_(window.sview_offset + window.sview_len <= len(a.getvalue()))
- self.assert_(window.tview_len <= len(b.getvalue()))
- self.assert_(len(window.new_data) > 0)
+ self.assertTrue(window.sview_offset + window.sview_len <=
len(a.getvalue()))
+ self.assertTrue(window.tview_len <= len(b.getvalue()))
+ self.assertTrue(len(window.new_data) > 0)
self.assertEqual(window.num_ops, len(window.ops))
self.assertEqual(window.src_ops, len([op for op in window.ops
if op.action_code == svn.delta.svn_txdelta_source]))
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/mergeinfo.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/mergeinfo.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
---
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/mergeinfo.py
(original)
+++
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/mergeinfo.py
Mon Nov 6 01:58:20 2017
@@ -93,9 +93,9 @@ class SubversionMergeinfoTestCase(unitte
reversed_rl = core.svn_rangelist_reverse(rangelist)
expected_ranges = ((42, 41), (27, 26), (9, 2))
for i in range(0, len(reversed_rl)):
- self.assertEquals(reversed_rl[i].start, expected_ranges[i][0],
+ self.assertEqual(reversed_rl[i].start, expected_ranges[i][0],
"Unexpected range start: %d" % reversed_rl[i].start)
- self.assertEquals(reversed_rl[i].end, expected_ranges[i][1],
+ self.assertEqual(reversed_rl[i].end, expected_ranges[i][1],
"Unexpected range end: %d" % reversed_rl[i].end)
def test_mergeinfo_sort(self):
@@ -131,7 +131,7 @@ class SubversionMergeinfoTestCase(unitte
# When reference counting is working properly, each svn_merge_range_t in
# the returned mergeinfo will have a ref count of 1...
mergeinfo = core.svn_mergeinfo_parse(self.TEXT_MERGEINFO1)
- for (path, rangelist) in mergeinfo.items():
+ for (path, rangelist) in list(mergeinfo.items()):
# ....and now 2 (incref during iteration of rangelist)
for (i, r) in enumerate(rangelist):
@@ -144,7 +144,7 @@ class SubversionMergeinfoTestCase(unitte
# Note: if path and index are not '/trunk' and 0 respectively, then
# only some of the range objects are leaking, which is, as far as
# leaks go, even more impressive.
- self.assertEquals(refcount, expected, (
+ self.assertEqual(refcount, expected, (
"Memory leak! Expected a ref count of %d for svn_merge_range_t "
"object, but got %d instead (path: %s, index: %d). Probable "
"cause: incorrect Py_INCREF/Py_DECREF usage in libsvn_swig_py/"
@@ -165,7 +165,7 @@ class SubversionMergeinfoTestCase(unitte
del mergeinfo
gc.collect()
lingering = get_svn_merge_range_t_objects()
- self.assertEquals(lingering, list(), (
+ self.assertEqual(lingering, list(), (
"Memory leak! Found lingering svn_merge_range_t objects left over from "
"our call to svn_mergeinfo_parse(), even though we explicitly deleted "
"the returned mergeinfo object. Probable cause: incorrect Py_INCREF/"
@@ -177,16 +177,16 @@ class SubversionMergeinfoTestCase(unitte
self.inspect_rangelist_tuple(rangelist, nbr_rev_ranges)
def inspect_rangelist_tuple(self, rangelist, nbr_rev_ranges):
- self.assert_(rangelist is not None,
+ self.assertTrue(rangelist is not None,
"Rangelist for '%s' not parsed" % self.MERGEINFO_SRC)
- self.assertEquals(len(rangelist), nbr_rev_ranges,
+ self.assertEqual(len(rangelist), nbr_rev_ranges,
"Wrong number of revision ranges parsed")
- self.assertEquals(rangelist[0].inheritable, True,
+ self.assertEqual(rangelist[0].inheritable, True,
"Unexpected revision range 'non-inheritable' flag: %s" %
rangelist[0].inheritable)
- self.assertEquals(rangelist[1].start, 26,
+ self.assertEqual(rangelist[1].start, 26,
"Unexpected revision range end: %d" % rangelist[1].start)
- self.assertEquals(rangelist[2].inheritable, False,
+ self.assertEqual(rangelist[2].inheritable, False,
"Missing revision range 'non-inheritable' flag")
def compare_mergeinfo_catalogs(self, catalog1, catalog2):
@@ -194,7 +194,7 @@ class SubversionMergeinfoTestCase(unitte
keys2 = sorted(catalog2.keys())
self.assertEqual(keys1, keys2)
- for k in catalog1.keys():
+ for k in catalog1:
self.compare_mergeinfos(catalog1[k], catalog2[k])
def compare_mergeinfos(self, mergeinfo1, mergeinfo2):
@@ -202,7 +202,7 @@ class SubversionMergeinfoTestCase(unitte
keys2 = sorted(mergeinfo2.keys())
self.assertEqual(keys1, keys2)
- for k in mergeinfo1.keys():
+ for k in mergeinfo1:
self.compare_rangelists(mergeinfo1[k], mergeinfo2[k])
def compare_rangelists(self, rangelist1, rangelist2):
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/ra.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/ra.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/ra.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/ra.py
Mon Nov 6 01:58:20 2017
@@ -85,14 +85,14 @@ class SubversionRepositoryAccessTestCase
def test_get_dir2(self):
(dirents, _, props) = ra.get_dir2(self.ra_ctx, '', 1, core.SVN_DIRENT_KIND)
- self.assert_('trunk' in dirents)
- self.assert_('branches' in dirents)
- self.assert_('tags' in dirents)
+ self.assertTrue('trunk' in dirents)
+ self.assertTrue('branches' in dirents)
+ self.assertTrue('tags' in dirents)
self.assertEqual(dirents['trunk'].kind, core.svn_node_dir)
self.assertEqual(dirents['branches'].kind, core.svn_node_dir)
self.assertEqual(dirents['tags'].kind, core.svn_node_dir)
- self.assert_(core.SVN_PROP_ENTRY_UUID in props)
- self.assert_(core.SVN_PROP_ENTRY_LAST_AUTHOR in props)
+ self.assertTrue(core.SVN_PROP_ENTRY_UUID in props)
+ self.assertTrue(core.SVN_PROP_ENTRY_LAST_AUTHOR in props)
(dirents, _, _) = ra.get_dir2(self.ra_ctx, 'trunk', 1,
core.SVN_DIRENT_KIND)
@@ -101,7 +101,7 @@ class SubversionRepositoryAccessTestCase
(dirents, _, _) = ra.get_dir2(self.ra_ctx, 'trunk', 10,
core.SVN_DIRENT_KIND)
- self.assert_('README2.txt' in dirents)
+ self.assertTrue('README2.txt' in dirents)
self.assertEqual(dirents['README2.txt'].kind, core.svn_node_file)
def test_commit3(self):
@@ -164,7 +164,7 @@ class SubversionRepositoryAccessTestCase
commit_cb, None, False)
try:
def driver_cb(parent, path, pool):
- self.assert_(path in all_paths)
+ self.assertTrue(path in all_paths)
dir_baton = file_baton = None
if path in to_delete:
# Leave dir_baton alone, as it must be None for delete.
@@ -215,9 +215,9 @@ class SubversionRepositoryAccessTestCase
self.assertEqual(author, info.author)
self.assertEqual(date, info.date)
self.assertEqual(message, revprops['svn:log'])
- for (path, change) in changed_paths.items():
+ for (path, change) in list(changed_paths.items()):
path = path.lstrip('/')
- self.assert_(path in all_paths)
+ self.assertTrue(path in all_paths)
if path in to_delete:
self.assertEqual(change.action, 'D')
elif path in to_mkdir or path in to_add:
@@ -229,7 +229,7 @@ class SubversionRepositoryAccessTestCase
True, # discover_changed_paths
True, # strict_node_history
receiver)
- self.assert_(receiver_called[0])
+ self.assertTrue(receiver_called[0])
def test_do_diff2(self):
@@ -278,7 +278,7 @@ class SubversionRepositoryAccessTestCase
def test_get_file_revs(self):
def rev_handler(path, rev, rev_props, prop_diffs, pool):
- self.assert_(rev == 2 or rev == 3)
+ self.assertTrue(rev == 2 or rev == 3)
self.assertEqual(path, "/trunk/README.txt")
if rev == 2:
self.assertEqual(rev_props, {
@@ -309,7 +309,7 @@ class SubversionRepositoryAccessTestCase
self.assertEqual(lock.owner, "jrandom")
self.locks += 1
if ra_err:
- self.assert_(ra_err.apr_err == core.SVN_ERR_FS_PATH_ALREADY_LOCKED
+ self.assertTrue(ra_err.apr_err == core.SVN_ERR_FS_PATH_ALREADY_LOCKED
or ra_err.apr_err == core.SVN_ERR_FS_NO_SUCH_LOCK)
self.errors += 1
@@ -351,8 +351,8 @@ class SubversionRepositoryAccessTestCase
self.test_commit3()
rev = fs.youngest_rev(self.fs)
revprops = ra.rev_proplist(self.ra_ctx, rev)
- self.assert_("svn:log" in revprops)
- self.assert_("testprop" in revprops)
+ self.assertTrue("svn:log" in revprops)
+ self.assertTrue("testprop" in revprops)
def receiver(log_entry, pool):
called[0] = True
@@ -360,7 +360,7 @@ class SubversionRepositoryAccessTestCase
if discover_changed_paths:
self.assertEqual(list(log_entry.changed_paths.keys()), ['/bla3'])
changed_path = log_entry.changed_paths['/bla3']
- self.assert_(changed_path.action in ['A', 'D', 'R', 'M'])
+ self.assertTrue(changed_path.action in ['A', 'D', 'R', 'M'])
self.assertEqual(changed_path.copyfrom_path, None)
self.assertEqual(changed_path.copyfrom_rev, -1)
else:
@@ -368,7 +368,7 @@ class SubversionRepositoryAccessTestCase
if log_revprops is None:
self.assertEqual(log_entry.revprops, revprops)
elif len(log_revprops) == 0:
- self.assert_(log_entry.revprops == None or len(log_entry.revprops) ==
0)
+ self.assertTrue(log_entry.revprops == None or len(log_entry.revprops)
== 0)
else:
revprop_names = sorted(log_entry.revprops.keys())
log_revprops.sort()
@@ -398,7 +398,7 @@ class SubversionRepositoryAccessTestCase
True, # strict_node_history
False, # include_merged_revisions
log_revprops, receiver)
- self.assert_(called[0])
+ self.assertTrue(called[0])
def test_update(self):
class TestEditor(delta.Editor):
@@ -424,7 +424,7 @@ class SubversionRepositoryAccessTestCase
return 'namestring_test'
self.callbacks.get_client_string = cb
ra.stat(self.ra_ctx, "", 1)
- self.assert_(called[0])
+ self.assertTrue(called[0])
def suite():
return unittest.defaultTestLoader.loadTestsFromTestCase(
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/repository.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/repository.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
---
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/repository.py
(original)
+++
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/repository.py
Mon Nov 6 01:58:20 2017
@@ -139,9 +139,9 @@ class SubversionRepositoryTestCase(unitt
dump = dumpstream.getvalue()
feedback = feedbackstream.getvalue()
expected_feedback = "* Dumped revision " + str(self.rev)
- self.assertEquals(dump.count("Node-path: trunk/README.txt"), 2)
- self.assertEquals(feedback.count(expected_feedback), 1)
- self.assertEquals(self.callback_calls, 13)
+ self.assertEqual(dump.count("Node-path: trunk/README.txt"), 2)
+ self.assertEqual(feedback.count(expected_feedback), 1)
+ self.assertEqual(self.callback_calls, 13)
# Check that the dump can be cancelled
self.assertRaises(SubversionException, repos.dump_fs2,
@@ -160,16 +160,16 @@ class SubversionRepositoryTestCase(unitt
# Check that we can grab the feedback stream, but not the dumpstream
repos.dump_fs2(self.repos, None, feedbackstream, 0, self.rev, 0, 0, None)
feedback = feedbackstream.getvalue()
- self.assertEquals(feedback.count(expected_feedback), 1)
+ self.assertEqual(feedback.count(expected_feedback), 1)
# Check that we can grab the dumpstream, but not the feedbackstream
repos.dump_fs2(self.repos, dumpstream, None, 0, self.rev, 0, 0, None)
dump = dumpstream.getvalue()
- self.assertEquals(dump.count("Node-path: trunk/README.txt"), 2)
+ self.assertEqual(dump.count("Node-path: trunk/README.txt"), 2)
# Check that we can ignore both the dumpstream and the feedbackstream
repos.dump_fs2(self.repos, dumpstream, None, 0, self.rev, 0, 0, None)
- self.assertEquals(feedback.count(expected_feedback), 1)
+ self.assertEqual(feedback.count(expected_feedback), 1)
# FIXME: The Python bindings don't check for 'NULL' values for
# svn_repos_t objects, so the following call segfaults
@@ -244,7 +244,7 @@ class SubversionRepositoryTestCase(unitt
# Count and verify changes
change_count = 0
for log in logs:
- for path_changed in log.values():
+ for path_changed in list(log.values()):
change_count += 1
path_changed.assert_valid()
self.assertEqual(logs[2]["/tags/v1.1"].action, "A")
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/run_all.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/run_all.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
---
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/run_all.py
(original)
+++
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/run_all.py
Mon Nov 6 01:58:20 2017
@@ -18,6 +18,7 @@
# under the License.
#
#
+import sys
import unittest, setup_path
import mergeinfo, core, client, delta, checksum, pool, ra, wc, repository, \
auth, trac.versioncontrol.tests
@@ -28,7 +29,10 @@ from svn.core import svn_cache_config_ge
def suite():
"""Run all tests"""
settings = svn_cache_config_get()
- settings.cache_size = long(1024*1024*32) ### Need explicit long
+ if sys.hexversion < 0x3000000:
+ settings.cache_size = long(1024*1024*32) ### Need explicit long
+ else:
+ settings.cache_size = 1024*1024*32
svn_cache_config_set(settings)
s = unittest.TestSuite()
s.addTest(core.suite())
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/svn_fs.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/svn_fs.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
---
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/svn_fs.py
(original)
+++
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/svn_fs.py
Mon Nov 6 01:58:20 2017
@@ -322,7 +322,7 @@ class SubversionNode(Node):
if self.isfile:
return
entries = fs.dir_entries(self.root, self.scoped_path)
- for item in entries.keys():
+ for item in entries:
path = '/'.join((self.path, item))
if not self.authz.has_permission(path):
continue
@@ -349,7 +349,7 @@ class SubversionNode(Node):
def get_properties(self):
props = fs.node_proplist(self.root, self.scoped_path)
- for name,value in props.items():
+ for name,value in list(props.items()):
props[name] = str(value) # Make sure the value is a proper string
return props
@@ -394,7 +394,7 @@ class SubversionChangeset(Changeset):
idx = 0
copies, deletions = {}, {}
changes = []
- for path, change in editor.changes.items():
+ for path, change in list(editor.changes.items()):
if not self.authz.has_permission(path):
# FIXME: what about base_path?
continue
@@ -424,7 +424,7 @@ class SubversionChangeset(Changeset):
idx += 1
moves = []
- for k,v in copies.items():
+ for k,v in list(copies.items()):
if k in deletions:
changes[v][2] = Changeset.MOVE
moves.append(deletions[k])
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
---
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py
(original)
+++
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svn_fs.py
Mon Nov 6 01:58:20 2017
@@ -53,17 +53,19 @@ import shutil
import sys
import tempfile
import unittest
-from urllib import pathname2url
if sys.version_info[0] >= 3:
# Python >=3.0
from io import StringIO
+ from urllib.request import pathname2url
else:
# Python <3.0
try:
- from cStringIO import StringIO
+ from io import StringIO
except ImportError:
- from StringIO import StringIO
+ from io import StringIO
+
+ from urllib import pathname2url
from svn import core, repos
@@ -156,15 +158,16 @@ class SubversionRepositoryTestCase(unitt
def test_get_dir_entries(self):
node = self.repos.get_node('/trunk')
entries = node.get_entries()
- self.assertEqual('README2.txt', entries.next().name)
- self.assertEqual('dir1', entries.next().name)
- self.assertEqual('README.txt', entries.next().name)
- self.assertRaises(StopIteration, entries.next)
+ self.assertSequenceEqual([entry.name for entry in entries],
+ ['README2.txt',
+ 'dir1',
+ 'README.txt'])
def test_get_file_entries(self):
node = self.repos.get_node('/trunk/README.txt')
entries = node.get_entries()
- self.assertRaises(StopIteration, entries.next)
+ self.assertSequenceEqual([entry.name for entry in entries],
+ [])
def test_get_dir_content(self):
node = self.repos.get_node('/trunk')
@@ -194,42 +197,42 @@ class SubversionRepositoryTestCase(unitt
def test_get_node_history(self):
node = self.repos.get_node('/trunk/README2.txt')
history = node.get_history()
- self.assertEqual(('trunk/README2.txt', 6, 'copy'), history.next())
- self.assertEqual(('trunk/README.txt', 3, 'edit'), history.next())
- self.assertEqual(('trunk/README.txt', 2, 'add'), history.next())
- self.assertRaises(StopIteration, history.next)
+ self.assertSequenceEqual([x for x in history],
+ [('trunk/README2.txt', 6, 'copy'),
+ ('trunk/README.txt', 3, 'edit'),
+ ('trunk/README.txt', 2, 'add')])
def test_get_node_history_follow_copy(self):
node = self.repos.get_node('/tags/v1/README.txt')
history = node.get_history()
- self.assertEqual(('tags/v1/README.txt', 7, 'copy'), history.next())
- self.assertEqual(('trunk/README.txt', 3, 'edit'), history.next())
- self.assertEqual(('trunk/README.txt', 2, 'add'), history.next())
- self.assertRaises(StopIteration, history.next)
+ self.assertSequenceEqual([x for x in history],
+ [('tags/v1/README.txt', 7, 'copy'),
+ ('trunk/README.txt', 3, 'edit'),
+ ('trunk/README.txt', 2, 'add')])
# Revision Log / path history
def test_get_path_history(self):
history = self.repos.get_path_history('/trunk/README2.txt', None)
- self.assertEqual(('trunk/README2.txt', 6, 'copy'), history.next())
- self.assertEqual(('trunk/README.txt', 3, 'unknown'), history.next())
- self.assertRaises(StopIteration, history.next)
+ self.assertSequenceEqual([x for x in history],
+ [('trunk/README2.txt', 6, 'copy'),
+ ('trunk/README.txt', 3, 'unknown')])
def test_get_path_history_copied_file(self):
history = self.repos.get_path_history('/tags/v1/README.txt', None)
- self.assertEqual(('tags/v1/README.txt', 7, 'copy'), history.next())
- self.assertEqual(('trunk/README.txt', 3, 'unknown'), history.next())
- self.assertRaises(StopIteration, history.next)
+ self.assertSequenceEqual([x for x in history],
+ [('tags/v1/README.txt', 7, 'copy'),
+ ('trunk/README.txt', 3, 'unknown')])
def test_get_path_history_copied_dir(self):
history = self.repos.get_path_history('/branches/v1x', None)
- self.assertEqual(('branches/v1x', 12, 'copy'), history.next())
- self.assertEqual(('tags/v1.1', 10, 'unknown'), history.next())
- self.assertEqual(('branches/v1x', 11, 'delete'), history.next())
- self.assertEqual(('branches/v1x', 9, 'edit'), history.next())
- self.assertEqual(('branches/v1x', 8, 'copy'), history.next())
- self.assertEqual(('tags/v1', 7, 'unknown'), history.next())
- self.assertRaises(StopIteration, history.next)
+ self.assertSequenceEqual([x for x in history],
+ [('branches/v1x', 12, 'copy'),
+ ('tags/v1.1', 10, 'unknown'),
+ ('branches/v1x', 11, 'delete'),
+ ('branches/v1x', 9, 'edit'),
+ ('branches/v1x', 8, 'copy'),
+ ('tags/v1', 7, 'unknown')])
# Diffs
@@ -246,21 +249,21 @@ class SubversionRepositoryTestCase(unitt
diffs = self.repos.get_deltas('trunk/README.txt', 2,
'trunk/README.txt', 3)
self._cmp_diff((('trunk/README.txt', 2),
('trunk/README.txt', 3),
- (Node.FILE, Changeset.EDIT)), diffs.next())
- self.assertRaises(StopIteration, diffs.next)
+ (Node.FILE, Changeset.EDIT)), next(diffs))
+ self.assertRaises(StopIteration, lambda *args: next(diffs))
def test_diff_file_different_files(self):
diffs = self.repos.get_deltas('branches/v1x/README.txt', 12,
'branches/v1x/README2.txt', 12)
self._cmp_diff((('branches/v1x/README.txt', 12),
('branches/v1x/README2.txt', 12),
- (Node.FILE, Changeset.EDIT)), diffs.next())
- self.assertRaises(StopIteration, diffs.next)
+ (Node.FILE, Changeset.EDIT)), next(diffs))
+ self.assertRaises(StopIteration, lambda *args: next(diffs))
def test_diff_file_no_change(self):
diffs = self.repos.get_deltas('trunk/README.txt', 7,
'tags/v1/README.txt', 7)
- self.assertRaises(StopIteration, diffs.next)
+ self.assertRaises(StopIteration, lambda *args: next(diffs))
def test_diff_dir_different_revs(self):
diffs = self.repos.get_deltas('trunk', 4, 'trunk', 8)
@@ -276,14 +279,14 @@ class SubversionRepositoryTestCase(unitt
(('trunk/dir3', 4), None,
(Node.DIRECTORY, Changeset.DELETE)),
]
- actual = [diffs.next() for i in range(5)]
+ actual = [next(diffs) for i in range(5)]
actual = sorted(actual,
key=lambda diff: ((diff[0] or diff[1]).path,
(diff[0] or diff[1]).rev))
self.assertEqual(len(expected), len(actual))
for e,a in zip(expected, actual):
self._cmp_diff(e,a)
- self.assertRaises(StopIteration, diffs.next)
+ self.assertRaises(StopIteration, lambda *args: next(diffs))
def test_diff_dir_different_dirs(self):
diffs = self.repos.get_deltas('trunk', 1, 'branches/v1x', 12)
@@ -299,7 +302,7 @@ class SubversionRepositoryTestCase(unitt
(None, ('branches/v1x/dir1/dir3', 12),
(Node.DIRECTORY, Changeset.ADD)),
]
- actual = [diffs.next() for i in range(5)]
+ actual = [next(diffs) for i in range(5)]
actual = sorted(actual, key=lambda diff: (diff[1].path, diff[1].rev))
# for e,a in zip(expected, actual):
# t.write("%r\n" % (e,))
@@ -308,12 +311,12 @@ class SubversionRepositoryTestCase(unitt
self.assertEqual(len(expected), len(actual))
for e,a in zip(expected, actual):
self._cmp_diff(e,a)
- self.assertRaises(StopIteration, diffs.next)
+ self.assertRaises(StopIteration, lambda *args: next(diffs))
def test_diff_dir_no_change(self):
diffs = self.repos.get_deltas('trunk', 7,
'tags/v1', 7)
- self.assertRaises(StopIteration, diffs.next)
+ self.assertRaises(StopIteration, lambda *args: next(diffs))
# Changesets
@@ -323,7 +326,7 @@ class SubversionRepositoryTestCase(unitt
self.assertEqual(None, chgset.message)
self.assertEqual(None, chgset.author)
self.assertEqual(1112349461, chgset.date)
- self.assertRaises(StopIteration, chgset.get_changes().next)
+ self.assertRaises(StopIteration, lambda *args:
next(chgset.get_changes()))
def test_changeset_added_dirs(self):
chgset = self.repos.get_changeset(1)
@@ -333,13 +336,10 @@ class SubversionRepositoryTestCase(unitt
self.assertEqual(1112349652, chgset.date)
changes = chgset.get_changes()
- self.assertEqual(('trunk', Node.DIRECTORY, Changeset.ADD, None, -1),
- changes.next())
- self.assertEqual(('branches', Node.DIRECTORY, Changeset.ADD, None, -1),
- changes.next())
- self.assertEqual(('tags', Node.DIRECTORY, Changeset.ADD, None, -1),
- changes.next())
- self.assertRaises(StopIteration, changes.next)
+ self.assertSequenceEqual([x for x in changes],
+ [('trunk', Node.DIRECTORY, Changeset.ADD, None, -1),
+ ('branches', Node.DIRECTORY, Changeset.ADD, None, -1),
+ ('tags', Node.DIRECTORY, Changeset.ADD, None, -1)])
def test_changeset_file_edit(self):
chgset = self.repos.get_changeset(3)
@@ -349,9 +349,9 @@ class SubversionRepositoryTestCase(unitt
self.assertEqual(1112361898, chgset.date)
changes = chgset.get_changes()
- self.assertEqual(('trunk/README.txt', Node.FILE, Changeset.EDIT,
- 'trunk/README.txt', 2), changes.next())
- self.assertRaises(StopIteration, changes.next)
+ self.assertSequenceEqual([x for x in changes],
+ [('trunk/README.txt', Node.FILE,
Changeset.EDIT,
+ 'trunk/README.txt', 2)])
def test_changeset_dir_moves(self):
chgset = self.repos.get_changeset(5)
@@ -361,11 +361,9 @@ class SubversionRepositoryTestCase(unitt
self.assertEqual(1112372739, chgset.date)
changes = chgset.get_changes()
- self.assertEqual(('trunk/dir1/dir2', Node.DIRECTORY, Changeset.MOVE,
- 'trunk/dir2', 4), changes.next())
- self.assertEqual(('trunk/dir1/dir3', Node.DIRECTORY, Changeset.MOVE,
- 'trunk/dir3', 4), changes.next())
- self.assertRaises(StopIteration, changes.next)
+ self.assertSequenceEqual([x for x in changes],
+ [('trunk/dir1/dir2', Node.DIRECTORY, Changeset.MOVE, 'trunk/dir2',
4),
+ ('trunk/dir1/dir3', Node.DIRECTORY, Changeset.MOVE, 'trunk/dir3',
4)])
def test_changeset_file_copy(self):
chgset = self.repos.get_changeset(6)
@@ -375,9 +373,9 @@ class SubversionRepositoryTestCase(unitt
self.assertEqual(1112381806, chgset.date)
changes = chgset.get_changes()
- self.assertEqual(('trunk/README2.txt', Node.FILE, Changeset.COPY,
- 'trunk/README.txt', 3), changes.next())
- self.assertRaises(StopIteration, changes.next)
+ self.assertSequenceEqual([x for x in changes],
+ [('trunk/README2.txt', Node.FILE, Changeset.COPY,
+ 'trunk/README.txt', 3)])
def suite():
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/utils.py
Mon Nov 6 01:58:20 2017
@@ -18,9 +18,16 @@
# under the License.
#
#
-import os.path, sys, tempfile, urllib
+import os.path, sys, tempfile
from svn import core, repos
-from StringIO import StringIO
+try:
+ # Python >=3.0
+ from io import StringIO
+ from urllib.request import pathname2url
+except ImportError:
+ # Python <3.0
+ from cStringIO import StringIO
+ from urllib import pathname2url
class Temper(object):
"""Class to simplify allocation and cleanup of dummy Subversion
@@ -67,7 +74,7 @@ class Temper(object):
def file_uri_for_path(path):
"""Return the file: URI corresponding to the given path."""
- uri_path = urllib.pathname2url(path)
+ uri_path = pathname2url(path)
# pathname2url claims to return the path part of the URI, but on Windows
# it returns both the authority and path parts for no reason, which
Modified:
subversion/branches/swig-py3/subversion/bindings/swig/python/tests/wc.py
URL:
http://svn.apache.org/viewvc/subversion/branches/swig-py3/subversion/bindings/swig/python/tests/wc.py?rev=1814386&r1=1814385&r2=1814386&view=diff
==============================================================================
--- subversion/branches/swig-py3/subversion/bindings/swig/python/tests/wc.py
(original)
+++ subversion/branches/swig-py3/subversion/bindings/swig/python/tests/wc.py
Mon Nov 6 01:58:20 2017
@@ -78,22 +78,22 @@ class SubversionWorkingCopyTestCase(unit
self.assertEqual(self.path, wc.adm_access_path(self.wc))
def test_is_adm_dir(self):
- self.assert_(wc.is_adm_dir(".svn"))
- self.failIf(wc.is_adm_dir(".foosvn"))
+ self.assertTrue(wc.is_adm_dir(".svn"))
+ self.assertFalse(wc.is_adm_dir(".foosvn"))
def test_get_adm_dir(self):
- self.assert_(isinstance(wc.get_adm_dir(), basestring))
+ self.assertTrue(isinstance(wc.get_adm_dir(), str))
def test_set_adm_dir(self):
self.assertRaises(SubversionException, wc.set_adm_dir, ".foobar")
- self.assert_(wc.is_adm_dir(".svn"))
- self.failIf(wc.is_adm_dir("_svn"))
- self.failIf(wc.is_adm_dir(".foobar"))
+ self.assertTrue(wc.is_adm_dir(".svn"))
+ self.assertFalse(wc.is_adm_dir("_svn"))
+ self.assertFalse(wc.is_adm_dir(".foobar"))
wc.set_adm_dir("_svn")
- self.assert_(wc.is_adm_dir("_svn"))
+ self.assertTrue(wc.is_adm_dir("_svn"))
self.assertEqual("_svn", wc.get_adm_dir())
wc.set_adm_dir(".svn")
- self.failIf(wc.is_adm_dir("_svn"))
+ self.assertFalse(wc.is_adm_dir("_svn"))
self.assertEqual(".svn", wc.get_adm_dir())
def test_init_traversal_info(self):
@@ -128,7 +128,7 @@ class SubversionWorkingCopyTestCase(unit
# Remove trunk/README.txt
readme_path = '%s/trunk/README.txt' % self.path
- self.assert_(os.path.exists(readme_path))
+ self.assertTrue(os.path.exists(readme_path))
os.remove(readme_path)
# Restore trunk/README.txt using crawl_revision2
@@ -138,7 +138,7 @@ class SubversionWorkingCopyTestCase(unit
True, True, False, notify, info)
# Check that the report finished
- self.assert_(reporter.finished_report)
+ self.assertTrue(reporter.finished_report)
self.assertEqual([''], set_paths)
self.assertEqual(1, len(infos))
@@ -152,7 +152,7 @@ class SubversionWorkingCopyTestCase(unit
wc.create_notify(self.path, wc.notify_add)
def test_check_wc(self):
- self.assert_(wc.check_wc(self.path) > 0)
+ self.assertTrue(wc.check_wc(self.path) > 0)
def test_get_ancestry(self):
self.assertEqual([self.repos_uri, 12],
@@ -164,7 +164,7 @@ class SubversionWorkingCopyTestCase(unit
def test_status_editor(self):
paths = []
def status_func(target, status):
- self.assert_(target.startswith(self.path))
+ self.assertTrue(target.startswith(self.path))
paths.append(target)
(anchor_access, target_access,
@@ -181,29 +181,29 @@ class SubversionWorkingCopyTestCase(unit
None, # traversal_info
)
editor.close_edit(edit_baton)
- self.assert_(len(paths) > 0)
+ self.assertTrue(len(paths) > 0)
def test_is_normal_prop(self):
- self.failIf(wc.is_normal_prop('svn:wc:foo:bar'))
- self.failIf(wc.is_normal_prop('svn:entry:foo:bar'))
- self.assert_(wc.is_normal_prop('svn:foo:bar'))
- self.assert_(wc.is_normal_prop('foreign:foo:bar'))
+ self.assertFalse(wc.is_normal_prop('svn:wc:foo:bar'))
+ self.assertFalse(wc.is_normal_prop('svn:entry:foo:bar'))
+ self.assertTrue(wc.is_normal_prop('svn:foo:bar'))
+ self.assertTrue(wc.is_normal_prop('foreign:foo:bar'))
def test_is_wc_prop(self):
- self.assert_(wc.is_wc_prop('svn:wc:foo:bar'))
- self.failIf(wc.is_wc_prop('svn:entry:foo:bar'))
- self.failIf(wc.is_wc_prop('svn:foo:bar'))
- self.failIf(wc.is_wc_prop('foreign:foo:bar'))
+ self.assertTrue(wc.is_wc_prop('svn:wc:foo:bar'))
+ self.assertFalse(wc.is_wc_prop('svn:entry:foo:bar'))
+ self.assertFalse(wc.is_wc_prop('svn:foo:bar'))
+ self.assertFalse(wc.is_wc_prop('foreign:foo:bar'))
def test_is_entry_prop(self):
- self.assert_(wc.is_entry_prop('svn:entry:foo:bar'))
- self.failIf(wc.is_entry_prop('svn:wc:foo:bar'))
- self.failIf(wc.is_entry_prop('svn:foo:bar'))
- self.failIf(wc.is_entry_prop('foreign:foo:bar'))
+ self.assertTrue(wc.is_entry_prop('svn:entry:foo:bar'))
+ self.assertFalse(wc.is_entry_prop('svn:wc:foo:bar'))
+ self.assertFalse(wc.is_entry_prop('svn:foo:bar'))
+ self.assertFalse(wc.is_entry_prop('foreign:foo:bar'))
def test_get_prop_diffs(self):
wc.prop_set("foreign:foo", "bla", self.path, self.wc)
- self.assertEquals([{"foreign:foo": "bla"}, {}],
+ self.assertEqual([{"foreign:foo": "bla"}, {}],
wc.get_prop_diffs(self.path, self.wc))
def test_get_pristine_copy_path(self):
@@ -221,7 +221,7 @@ class SubversionWorkingCopyTestCase(unit
self.assertEqual(['', 'branches', 'tags', 'trunk'], keys)
def test_get_ignores(self):
- self.assert_(isinstance(wc.get_ignores(None, self.wc), list))
+ self.assertTrue(isinstance(wc.get_ignores(None, self.wc), list))
def test_commit(self):
# Replace README.txt's contents, using binary mode so we know the
@@ -269,9 +269,9 @@ class SubversionWorkingCopyTestCase(unit
(commit_info,) = commit_info
# Assert the commit.
- self.assertEquals(binascii.b2a_hex(checksum),
+ self.assertEqual(binascii.b2a_hex(checksum),
'b1946ac92492d2347c6235b4d2611184')
- self.assertEquals(commit_info.revision, 13)
+ self.assertEqual(commit_info.revision, 13)
# Bump working copy state.
wc.process_committed4(readme_path,
@@ -282,10 +282,10 @@ class SubversionWorkingCopyTestCase(unit
# Assert bumped state.
entry = wc.entry(readme_path, self.wc, False)
- self.assertEquals(entry.revision, commit_info.revision)
- self.assertEquals(entry.schedule, wc.schedule_normal)
- self.assertEquals(entry.cmt_rev, commit_info.revision)
- self.assertEquals(entry.cmt_date,
+ self.assertEqual(entry.revision, commit_info.revision)
+ self.assertEqual(entry.schedule, wc.schedule_normal)
+ self.assertEqual(entry.cmt_rev, commit_info.revision)
+ self.assertEqual(entry.cmt_date,
core.svn_time_from_cstring(commit_info.date))
def test_diff_editor4(self):
@@ -331,7 +331,7 @@ class SubversionWorkingCopyTestCase(unit
# Save prop changes.
got_prop_changes = []
def props_changed(path, propchanges):
- for (name, value) in propchanges.items():
+ for (name, value) in list(propchanges.items()):
(kind, _) = core.svn_property_kind(name)
if kind != core.svn_prop_regular_kind:
continue