You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Jun Omae <ju...@gmail.com> on 2022/03/04 00:06:09 UTC

Re: svn commit: r1898528 - /subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/diff_tests.py

Hi,

On 2022/03/02 23:12, julianfoad@apache.org wrote:
> Author: julianfoad
> Date: Wed Mar  2 14:12:33 2022
> New Revision: 1898528
> 
> URL: http://svn.apache.org/viewvc?rev=1898528&view=rev
> Log:
> On the 'pristines-on-demand-on-mwf' branch: fix disabled tests.
> 
> * subversion/tests/cmdline/diff_tests.py
>    (diff_external_diffcmd): Re-enable. Allow path to the pristine version to
>      be a temporary file.
> 
> Modified:
>      subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/diff_tests.py
> 
> Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/diff_tests.py
> URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/diff_tests.py?rev=1898528&r1=1898527&r2=1898528&view=diff
> ==============================================================================
> --- subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/diff_tests.py (original)
> +++ subversion/branches/pristines-on-demand-on-mwf/subversion/tests/cmdline/diff_tests.py Wed Mar  2 14:12:33 2022
> @@ -3063,7 +3063,6 @@ def diff_wrong_extension_type(sbox):
>                                        'diff', '-x', sbox.wc_dir, '-r', '1')
>   
>   # Check the order of the arguments for an external diff tool
> -@Wimp("Relies on wc.text_base_path()")
>   def diff_external_diffcmd(sbox):
>     "svn diff --diff-cmd provides the correct arguments"
>   
> @@ -3083,15 +3082,15 @@ def diff_external_diffcmd(sbox):
>     if sys.platform == 'win32':
>       diff_script_path = "%s.bat" % diff_script_path
>   
> -  expected_output = svntest.verify.ExpectedOutput([
> +  expected_output = svntest.verify.RegexListOutput([
>       "Index: iota\n",
>       "===================================================================\n",
>       "-u\n",
>       "-L\n",
> -    "iota\t(revision 1)\n",
> +    r"iota\t\(revision 1\)\n",
>       "-L\n",
> -    "iota\t(working copy)\n",
> -    os.path.abspath(svntest.wc.text_base_path("iota")) + "\n",
> +    r"iota\t\(working copy\)\n",
> +    os.path.abspath(svntest.main.get_admin_name()) + '.*' + "\n",
>       os.path.abspath("iota") + "\n"])
>   
>     # Check that the output of diff corresponds with the expected arguments,
> 
> 

After r1898528, the following error is raised from diff_tests.py 48.

[[[
W: CWD: C:\usr\src\subversion\pristines-on-demand-on-mwf\Release\subversion\tests\cmdline\svn-test-work\working_copies\diff_tests-48
Traceback (most recent call last):
   File "C:\usr\src\subversion\pristines-on-demand-on-mwf\subversion\tests\cmdline\svntest\main.py", line 1978, in run
     rc = self.pred.run(sandbox)
   File "C:\usr\src\subversion\pristines-on-demand-on-mwf\subversion\tests\cmdline\svntest\testcase.py", line 178, in run
     result = self.func(sandbox)
   File "C:\usr\src\subversion\pristines-on-demand-on-mwf\subversion\tests\cmdline\diff_tests.py", line 3085, in diff_external_diffcmd
     expected_output = svntest.verify.RegexListOutput([
   ...
   File "C:\usr\apps\python310\lib\sre_parse.py", line 375, in _escape
     raise source.error("incomplete escape %s" % escape, len(escape))
re.error: incomplete escape \u at position 2 (line 1, column 3)
FAIL:  diff_tests.py 48: svn diff --diff-cmd provides the correct arguments
]]]

os.path.abspath(...) should be wrapped with re.esacpe() for RegexListOutput, to
escape meta characters. Especially, the path on Windows includes backslash
characters.

[[[
Index: subversion/tests/cmdline/diff_tests.py
===================================================================
--- subversion/tests/cmdline/diff_tests.py	(revision 1898567)
+++ subversion/tests/cmdline/diff_tests.py	(working copy)
@@ -3090,8 +3090,8 @@
      r"iota\t\(revision 1\)\n",
      "-L\n",
      r"iota\t\(working copy\)\n",
-    os.path.abspath(svntest.main.get_admin_name()) + '.*' + "\n",
-    os.path.abspath("iota") + "\n"])
+    re.escape(os.path.abspath(svntest.main.get_admin_name())) + '.*' + "\n",
+    re.escape(os.path.abspath("iota")) + "\n"])
  
    # Check that the output of diff corresponds with the expected arguments,
    # in the correct order.
]]]

-- 
Jun Omae <ju...@gmail.com> (大前 潤)