Index: test/testconf.py.in
===================================================================
--- test/testconf.py.in	(revision 354335)
+++ test/testconf.py.in	(working copy)
@@ -18,6 +18,9 @@
 # Path to the mod_python.so file, should be in the apache modules directory.
 MOD_PYTHON_SO="@MOD_PYTHON_SO@"
 
+# Set SVCNAME if you want to test via the given service
+SVCNAME=""
+
 # makes emacs go into python mode
 ### Local Variables:
 ### mode:python
Index: test/test.py
===================================================================
--- test/test.py	(revision 354335)
+++ test/test.py	(working copy)
@@ -176,6 +176,7 @@
 TESTHOME = testconf.TESTHOME
 MOD_PYTHON_SO = testconf.MOD_PYTHON_SO
 LIBEXECDIR = testconf.LIBEXECDIR
+SVCNAME = testconf.SVCNAME
 SERVER_ROOT = TESTHOME
 CONFIG = os.path.join(TESTHOME, "conf", "test.conf")
 DOCUMENT_ROOT = os.path.join(TESTHOME, "htdocs")
@@ -301,12 +302,38 @@
         f.write("\n# --APPENDED-- \n\n"+append)
         f.close()
 
+    def installService(self,extra=''):
+
+        print "  Installing Test Apache Service...."
+        httpd = quoteIfSpace(HTTPD)
+        config = quoteIfSpace(CONFIG)
+        cmd = '%s %s -k install -n %s -f %s' % (httpd, extra, SVCNAME, config)
+        print "    ", cmd
+        os.system(cmd)
+        time.sleep(1)
+        self.httpd_installed = 1
+
+    def uninstallService(self,extra=''):
+
+        print "  Uninstalling Test Apache Service...."
+        httpd = quoteIfSpace(HTTPD)
+        cmd = '%s -k uninstall -n %s' % (httpd, SVCNAME)
+        print "    ", cmd
+        os.system(cmd)
+        time.sleep(1)
+        self.httpd_installed = 0
+
     def startHttpd(self,extra=''):
 
+        if SVCNAME:
+            self.installService(extra)
         print "  Starting Apache...."
         httpd = quoteIfSpace(HTTPD)
         config = quoteIfSpace(CONFIG)
-        cmd = '%s %s -k start -f %s' % (httpd, extra, config)
+	if SVCNAME:
+            cmd = '%s %s -k start -n %s' % (httpd, extra, SVCNAME)
+        else:
+            cmd = '%s %s -k start -f %s' % (httpd, extra, config)
         print "    ", cmd
         os.system(cmd)
         time.sleep(1)
@@ -317,7 +344,10 @@
         print "  Stopping Apache..."
         httpd = quoteIfSpace(HTTPD)
         config = quoteIfSpace(CONFIG)
-        cmd = '%s -k stop -f %s' % (httpd, config)
+	if SVCNAME:
+            cmd = '%s -k stop -n %s' % (httpd, SVCNAME)
+        else:
+            cmd = '%s -k stop -f %s' % (httpd, config)
         print "    ", cmd
         os.system(cmd)
         time.sleep(1)
@@ -339,6 +369,9 @@
 
         self.httpd_running = 0
 
+        if SVCNAME:
+            self.uninstallService()
+
 class PerRequestTestCase(unittest.TestCase):
 
     appendConfig = "\nNameVirtualHost *\n\n"
@@ -1742,6 +1775,8 @@
     def tearDown(self):
         if self.httpd_running:
             self.stopHttpd()
+        if SVCNAME and self.httpd_installed:
+            self.uninstallService()
 
     def testLoadModule(self):
 
Index: test/README
===================================================================
--- test/README	(revision 354335)
+++ test/README	(working copy)
@@ -9,8 +9,7 @@
 configuration file, on its own TCP/IP port, so hopefully it won't break
 anything on your Apache setup.
 
-- The only trick is that you'll have to stop your Apache server before launching
-the test, as the start/stop command can only apply to one single Apache instance. 
+- The only trick is that on Windows you'll have to stop your Apache server before launching the test, as the start/stop command can only apply to one single Apache instance. To avoid this, set SVCNAME to something in testconf.py (e.g. "Apache2TestModPy".
 
 2) Setting up mod_python source code
 ------------------------------------
@@ -84,4 +83,4 @@
 we're also interested. Send us the full output of the test suite, or at least
 the stack trace of the failed tests.
 
-Thanks for your time spent of running those tests !
\ No newline at end of file
+Thanks for your time spent of running those tests !
