tests: convert the 'file://\$TESTTMP' rule to an automatic substitution
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 16 Dec 2017 11:32:10 -0500
changeset 35446 991e4404e910
parent 35445 b86f52426396
child 35447 e28dedf4ff43
tests: convert the 'file://\$TESTTMP' rule to an automatic substitution The rule only triggered on non Windows platforms, even though Windows also required an adjustment. Automatic seems better. The aggressive globbing in test-subrepo-svn.t was found and rewritten by the substitution.
contrib/check-code.py
tests/common-pattern.py
tests/test-subrepo-svn.t
--- a/contrib/check-code.py	Sat Oct 21 17:27:14 2017 +0900
+++ b/contrib/check-code.py	Sat Dec 16 11:32:10 2017 -0500
@@ -181,8 +181,6 @@
     (uprefix + r'.*:\.\S*/', "x:.y in a path does not work on msys, rewrite "
      "as x://.y, or see `hg log -k msys` for alternatives", r'-\S+:\.|' #-Rxxx
      '# no-msys'), # in test-pull.t which is skipped on windows
-    (r'^  .*file://\$TESTTMP',
-     'write "file:/*/$TESTTMP" + (glob) to match on windows too'),
     (r'^  [^$>].*27\.0\.0\.1',
      'use $LOCALIP not an explicit loopback address'),
     (r'^  (?![>$] ).*\$LOCALIP.*[^)]$',
--- a/tests/common-pattern.py	Sat Oct 21 17:27:14 2017 +0900
+++ b/tests/common-pattern.py	Sat Dec 16 11:32:10 2017 -0500
@@ -38,6 +38,14 @@
     (br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET',
      br' - - [$LOGDATE$] "GET'
     ),
+    # Windows has an extra '/' in the following lines that get globbed away:
+    #   pushing to file:/*/$TESTTMP/r2 (glob)
+    #   comparing with file:/*/$TESTTMP/r2 (glob)
+    #   sub/maybelarge.dat: largefile 34..9c not available from
+    #       file:/*/$TESTTMP/largefiles-repo (glob)
+    (br'(.*file:/)/?(/\$TESTTMP.*)',
+     lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)'
+    ),
 ]
 
 # Various platform error strings, keyed on a common replacement string
--- a/tests/test-subrepo-svn.t	Sat Oct 21 17:27:14 2017 +0900
+++ b/tests/test-subrepo-svn.t	Sat Dec 16 11:32:10 2017 -0500
@@ -91,10 +91,10 @@
 
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 change file in svn and hg, commit
@@ -117,10 +117,10 @@
   At revision 3.
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 3
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 missing svn file, commit should fail
@@ -239,10 +239,10 @@
 
   $ hg debugsub
   path s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 3
   path subdir/s
-   source   file://*/svn-repo/src (glob)
+   source   file:/*/$TESTTMP/svn-repo/src (glob)
    revision 2
 
 verify subrepo is contained within the repo directory