cherrypy.test.helper module¶
A library of helper functions for the CherryPy test suite.
- class cherrypy.test.helper.CPProcess(wait=False, daemonize=False, ssl=False, socket_host=None, socket_port=None)[source]¶
Bases:
object
CherryPy Process Spawning Helper.
- access_log = '/home/docs/checkouts/readthedocs.org/user_builds/cherrypy/envs/latest/lib/python3.6/site-packages/cherrypy/test/test.access.log'¶
- config_file = '/home/docs/checkouts/readthedocs.org/user_builds/cherrypy/envs/latest/lib/python3.6/site-packages/cherrypy/test/test.conf'¶
- config_template = "[global]\nserver.socket_host: '%(host)s'\nserver.socket_port: %(port)s\nchecker.on: False\nlog.screen: False\nlog.error_file: r'%(error_log)s'\nlog.access_file: r'%(access_log)s'\n%(ssl)s\n%(extra)s\n"¶
- error_log = '/home/docs/checkouts/readthedocs.org/user_builds/cherrypy/envs/latest/lib/python3.6/site-packages/cherrypy/test/test.error.log'¶
- pid_file = '/home/docs/checkouts/readthedocs.org/user_builds/cherrypy/envs/latest/lib/python3.6/site-packages/cherrypy/test/test.pid'¶
- class cherrypy.test.helper.CPWebCase(methodName='runTest')[source]¶
Bases:
WebCase
CherryPy web test case base.
- assertErrorPage(status, message=None, pattern='')[source]¶
Compare the response body with a built in error page.
The function will optionally look for the regexp pattern, within the exception embedded in the error page.
- available_servers = {'cpmodpy': <function get_cpmodpy_supervisor>, 'modfastcgi': <function get_modfastcgi_supervisor>, 'modfcgid': <function get_modfcgid_supervisor>, 'modpygw': <function get_modpygw_supervisor>, 'modwsgi': <function get_modwsgi_supervisor>, 'native': <class 'cherrypy.test.helper.NativeServerSupervisor'>, 'wsgi': <class 'cherrypy.test.helper.LocalWSGISupervisor'>, 'wsgi_u': <function get_wsgi_u_supervisor>}¶
- date_tolerance = 2¶
- default_server = 'wsgi'¶
- do_gc_test = False¶
- scheme = 'http'¶
- script_name = ''¶
- class cherrypy.test.helper.LocalSupervisor(**kwargs)[source]¶
Bases:
Supervisor
Base for modeling/controlling servers which run in the same process.
When the server side runs in a different process, start/stop can dump all state between each test module easily. When the server side runs in the same process as the client, however, we have to do a bit more work to ensure config and mounted apps are reset between tests.
- using_apache = False¶
- using_wsgi = False¶
- class cherrypy.test.helper.LocalWSGISupervisor(**kwargs)[source]¶
Bases:
LocalSupervisor
Server supervisor for the builtin WSGI server.
- httpserver_class = 'cherrypy._cpwsgi_server.CPWSGIServer'¶
- using_apache = False¶
- using_wsgi = True¶
- class cherrypy.test.helper.NativeServerSupervisor(**kwargs)[source]¶
Bases:
LocalSupervisor
Server supervisor for the builtin HTTP server.
- httpserver_class = 'cherrypy._cpnative_server.CPHTTPServer'¶
- using_apache = False¶
- using_wsgi = False¶
- class cherrypy.test.helper.Supervisor(**kwargs)[source]¶
Bases:
object
Base class for modeling and controlling servers during testing.
- cherrypy.test.helper._test_method_sorter(_, x, y)[source]¶
Monkeypatch the test sorter to always run test_gc last in each suite.
- cherrypy.test.helper.get_cpmodpy_supervisor(**options)[source]¶
Load a CherryPy
mod_python
supervisor.
- cherrypy.test.helper.get_modfastcgi_supervisor(**options)[source]¶
Load a CherryPy
mod_fastcgi
supervisor.
- cherrypy.test.helper.get_modfcgid_supervisor(**options)[source]¶
Load a CherryPy
mod_fcgi
supervisor.
- cherrypy.test.helper.get_modpygw_supervisor(**options)[source]¶
Load a CherryPy
mod_python
gateway supervisor.