Beispiel #1
0
    def start(self, modulename):
        mpconf = CONF_PATH
        if not os.path.isabs(mpconf):
            mpconf = os.path.join(curdir, mpconf)

        f = open(mpconf, 'wb')
        try:
            output = (self.template % {
                'port': self.port,
                'testmod': modulename,
                'curdir': curdir
            })
            f.write(output)
        finally:
            f.close()

        result = read_process(APACHE_PATH, '-k start -f %s' % mpconf)
        if result:
            print(result)

        # Make a request so mod_wsgi starts up our app.
        # If we don't, concurrent initial requests will 404.
        cherrypy._cpserver.wait_for_occupied_port('127.0.0.1', self.port)
        webtest.openURL('/ihopetheresnodefault', port=self.port)
        time.sleep(1)
Beispiel #2
0
    def start(self, modulename):
        mpconf = CONF_PATH
        if not os.path.isabs(mpconf):
            mpconf = os.path.join(curdir, mpconf)
        f = open(mpconf, 'wb')
        try:
            output = self.template % {'port': self.port,
             'testmod': modulename,
             'curdir': curdir}
            f.write(output)
        finally:
            f.close()

        result = read_process(APACHE_PATH, '-k start -f %s' % mpconf)
        if result:
            print result
        cherrypy._cpserver.wait_for_occupied_port('127.0.0.1', self.port)
        webtest.openURL('/ihopetheresnodefault', port=self.port)
        time.sleep(1)
Beispiel #3
0
    def start(self, modulename):
        mpconf = CONF_PATH
        if not os.path.isabs(mpconf):
            mpconf = os.path.join(curdir, mpconf)
        f = open(mpconf, 'wb')
        try:
            output = self.template % {'port': self.port,
             'testmod': modulename,
             'curdir': curdir}
            f.write(output)
        finally:
            f.close()

        result = read_process(APACHE_PATH, '-k start -f %s' % mpconf)
        if result:
            print result
        cherrypy._cpserver.wait_for_occupied_port('127.0.0.1', self.port)
        webtest.openURL('/ihopetheresnodefault', port=self.port)
        time.sleep(1)
    def start(self, modulename):
        mpconf = CONF_PATH
        if not os.path.isabs(mpconf):
            mpconf = os.path.join(curdir, mpconf)

        f = open(mpconf, "wb")
        try:
            output = self.template % {"port": self.port, "testmod": modulename, "curdir": curdir}
            f.write(output)
        finally:
            f.close()

        result = read_process(APACHE_PATH, "-k start -f %s" % mpconf)
        if result:
            print(result)

        # Make a request so mod_wsgi starts up our app.
        # If we don't, concurrent initial requests will 404.
        cherrypy._cpserver.wait_for_occupied_port("127.0.0.1", self.port)
        webtest.openURL("/ihopetheresnodefault", port=self.port)
        time.sleep(1)
Beispiel #5
0
    def _run(self, conf):
        cherrypy.server.using_wsgi = True
        cherrypy.server.using_apache = True

        from cherrypy.test import webtest
        webtest.WebCase.PORT = self.port
        webtest.WebCase.harness = self
        webtest.WebCase.scheme = "http"
        webtest.WebCase.interactive = self.interactive
        print
        print "Running tests:", self.server

        conf_template = conf_modwsgi

        # mod_wsgi, since it runs in the Apache process, must be
        # started separately for each test, and then *that* process
        # must run the setup_server() function for the test.
        # Then our process can run the actual test.
        success = True
        for testmod in self.tests:
            try:
                start(testmod, self.port, conf_template)
                cherrypy._cpserver.wait_for_occupied_port(
                    "127.0.0.1", self.port)
                suite = webtest.ReloadingTestLoader().loadTestsFromName(
                    testmod)
                # Make a request so mod_wsgi starts up our app.
                # If we don't, concurrent initial requests will 404.
                webtest.openURL('/ihopetheresnodefault', port=self.port)
                time.sleep(1)
                result = webtest.TerseTestRunner(verbosity=2).run(suite)
                success &= result.wasSuccessful()
            finally:
                stop()
        if success:
            return 0
        else:
            return 1
Beispiel #6
0
    def start(self, modulename):
        mpconf = CONF_PATH
        if not os.path.isabs(mpconf):
            mpconf = os.path.join(curdir, mpconf)

        f = open(mpconf, 'wb')
        try:
            output = (self.template %
                      {'port': self.port, 'testmod': modulename,
                       'curdir': curdir})
            f.write(output)
        finally:
            f.close()

        result = read_process(APACHE_PATH, '-k start -f %s' % mpconf)
        if result:
            print(result)

        # Make a request so mod_wsgi starts up our app.
        # If we don't, concurrent initial requests will 404.
        portend.occupied('127.0.0.1', self.port, timeout=5)
        webtest.openURL('/ihopetheresnodefault', port=self.port)
        time.sleep(1)
Beispiel #7
0
 def _run(self, conf):
     cherrypy.server.using_wsgi = True
     cherrypy.server.using_apache = True
     
     from cherrypy.test import webtest
     webtest.WebCase.PORT = self.port
     webtest.WebCase.harness = self
     webtest.WebCase.scheme = "http"
     webtest.WebCase.interactive = self.interactive
     print
     print "Running tests:", self.server
     
     conf_template = conf_modwsgi
     
     # mod_wsgi, since it runs in the Apache process, must be
     # started separately for each test, and then *that* process
     # must run the setup_server() function for the test.
     # Then our process can run the actual test.
     success = True
     for testmod in self.tests:
         try:
             start(testmod, self.port, conf_template)
             cherrypy._cpserver.wait_for_occupied_port("127.0.0.1", self.port)
             suite = webtest.ReloadingTestLoader().loadTestsFromName(testmod)
             # Make a request so mod_wsgi starts up our app.
             # If we don't, concurrent initial requests will 404.
             webtest.openURL('/ihopetheresnodefault', port=self.port)
             time.sleep(1)
             result = webtest.TerseTestRunner(verbosity=2).run(suite)
             success &= result.wasSuccessful()
         finally:
             stop()
     if success:
         return 0
     else:
         return 1