tests: prepare get-with-headers.py for MSYS stable
authorMads Kiilerich <mads@kiilerich.com>
Thu, 21 Jun 2012 03:05:02 +0200
branchstable
changeset 1106 a02b1025536c
parent 1105 9b2932ca75fd
child 1107 943253aadddb
tests: prepare get-with-headers.py for MSYS get-with-headers.py took the http GET parameter as a command line parameter that had to start with '/'. MSYS on windows will mangle such paths. Instead of applying a workaround everywhere (such as an extra '/') we let get-with-headers.py add the mandatory '/'. That is consistent with the url path handling in the Mercurial url class. A few tests sent 'GET ?cmd=...' which is invalid. They will now send 'GET /?cmd=...'. This will not enable any tests for being run on windows - only remove one reason they were disabled. [ original upstream message ]
tests/get-with-headers.py
tests/test-keyword.t
--- a/tests/get-with-headers.py	Wed Jun 20 23:41:21 2012 +0200
+++ b/tests/get-with-headers.py	Thu Jun 21 03:05:02 2012 +0200
@@ -21,14 +21,14 @@
 
 tag = None
 def request(host, path, show):
-
+    assert not path.startswith('/'), path
     global tag
     headers = {}
     if tag:
         headers['If-None-Match'] = tag
 
     conn = httplib.HTTPConnection(host)
-    conn.request("GET", path, None, headers)
+    conn.request("GET", '/' + path, None, headers)
     response = conn.getresponse()
     print response.status, reasons.get(response.reason, response.reason)
     for h in [h.lower() for h in show]:
--- a/tests/test-keyword.t	Wed Jun 20 23:41:21 2012 +0200
+++ b/tests/test-keyword.t	Thu Jun 21 03:05:02 2012 +0200
@@ -932,14 +932,14 @@
 
   $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
   $ cat hg.pid >> $DAEMON_PIDS
-  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw'
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'file/tip/a/?style=raw'
   200 Script output follows
   
   expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
   do not process $Id:
   xxx $
   $Xinfo: User Name <user@example.com>: firstline $
-  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw'
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'annotate/tip/a/?style=raw'
   200 Script output follows
   
   
@@ -951,7 +951,7 @@
   
   
   
-  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw'
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'rev/tip/?style=raw'
   200 Script output follows
   
   
@@ -971,7 +971,7 @@
   +xxx $
   +$Xinfo$
   
-  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw'
+  $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT 'diff/bb948857c743/a?style=raw'
   200 Script output follows