コード例 #1
0
 def run(self, conf=None):
     """Run the test harness (using the given [global] conf)."""
     import cherrypy
     v = sys.version.split()[0]
     print("Python version used to run this test script: %s" % v)
     print("CherryPy version: %s" % cherrypy.__version__)
     if self.supervisor.scheme == "https":
         ssl = " (ssl)"
     else:
         ssl = ""
     print("HTTP server version: %s%s" % (self.supervisor.protocol, ssl))
     print("PID: %s" % os.getpid())
     print("")
     
     cherrypy.server.using_apache = self.supervisor.using_apache
     cherrypy.server.using_wsgi = self.supervisor.using_wsgi
     
     if isinstance(conf, basestring):
         parser = cherrypy.config._Parser()
         conf = parser.dict_from_file(conf).get('global', {})
     else:
         conf = conf or {}
     baseconf = conf.copy()
     baseconf.update({'server.socket_host': self.supervisor.host,
                      'server.socket_port': self.supervisor.port,
                      'server.protocol_version': self.supervisor.protocol,
                      'environment': "test_suite",
                      })
     if self.supervisor.scheme == "https":
         baseconf['server.ssl_certificate'] = serverpem
         baseconf['server.ssl_private_key'] = serverpem
     
     # helper must be imported lazily so the coverage tool
     # can run against module-level statements within cherrypy.
     # Also, we have to do "from cherrypy.test import helper",
     # exactly like each test module does, because a relative import
     # would stick a second instance of webtest in sys.modules,
     # and we wouldn't be able to globally override the port anymore.
     from cherrypy.test import helper, webtest
     webtest.WebCase.interactive = self.interactive
     if self.supervisor.scheme == "https":
         webtest.WebCase.HTTP_CONN = HTTPSConnection
     print("")
     print("Running tests: %s" % self.supervisor)
     
     return helper.run_test_suite(self.tests, baseconf, self.supervisor)
コード例 #2
0
ファイル: test.py プロジェクト: fmcingvale/cherrypy_gae
 def _run(self, conf):
     # helper must be imported lazily so the coverage tool
     # can run against module-level statements within cherrypy.
     # Also, we have to do "from cherrypy.test import helper",
     # exactly like each test module does, because a relative import
     # would stick a second instance of webtest in sys.modules,
     # and we wouldn't be able to globally override the port anymore.
     from cherrypy.test import helper, webtest
     webtest.WebCase.PORT = self.port
     webtest.WebCase.HOST = self.host
     webtest.WebCase.harness = self
     helper.CPWebCase.scheme = self.scheme
     webtest.WebCase.interactive = self.interactive
     if self.scheme == "https":
         webtest.WebCase.HTTP_CONN = httplib.HTTPSConnection
     print
     print "Running tests:", self.server
     return helper.run_test_suite(self.tests, self.server, conf)
コード例 #3
0
ファイル: test.py プロジェクト: carvalhomb/tsmells
 def _run(self, conf):
     # helper must be imported lazily so the coverage tool
     # can run against module-level statements within cherrypy.
     # Also, we have to do "from cherrypy.test import helper",
     # exactly like each test module does, because a relative import
     # would stick a second instance of webtest in sys.modules,
     # and we wouldn't be able to globally override the port anymore.
     from cherrypy.test import helper, webtest
     webtest.WebCase.PORT = self.port
     webtest.WebCase.HOST = self.host
     webtest.WebCase.harness = self
     helper.CPWebCase.scheme = self.scheme
     webtest.WebCase.interactive = self.interactive
     if self.scheme == "https":
         webtest.WebCase.HTTP_CONN = httplib.HTTPSConnection
     print
     print "Running tests:", self.server
     return helper.run_test_suite(self.tests, self.server, conf)