pyfarm.agent.testutil module¶
- class pyfarm.agent.testutil.skipIf(should_skip, reason)[source]¶
Bases: object
Wrapping a test with this class will allow the test to be skipped if should_skip evals as True.
- pyfarm.agent.testutil.random_port(bind='127.0.0.1')[source]¶
Returns a random port which is not in use
- pyfarm.agent.testutil.requires_master(function)[source]¶
Any test decorated with this function will fail if the master could not be contacted or returned a response other than 200 OK for “/”
- pyfarm.agent.testutil.create_jobtype(classname=None, sourcecode=None)[source]¶
Creates a job type on the master and fires a deferred when finished
- class pyfarm.agent.testutil.FakeRequest(test, method, uri, headers=None, data=None)[source]¶
Bases: object
- class pyfarm.agent.testutil.TestCase(methodName='runTest')[source]¶
Bases: twisted.trial._asynctest.TestCase
- longMessage = True¶
- POP_CONFIG_KEYS = []¶
- RAND_LENGTH = 8¶
- timeout = 15¶
- assertRaisesRegexp(expected_exception, expected_regexp, callable_obj=None, *args, **kwargs)[source]¶
- create_file(content=None, dir=None, suffix='')[source]¶
Creates a test file on disk using tempfile.mkstemp() and uses the lower level file interfaces to manage it. This is done to ensure we have more control of the file descriptor itself so on platforms such as Windows we don’t have to worry about running out of file handles.
- class pyfarm.agent.testutil.BaseRequestTestCase(methodName='runTest')[source]¶
Bases: pyfarm.agent.testutil.TestCase
- HTTP_SCHEME = 'http'¶
- DNS_HOSTNAME = 'example.com'¶
- TEST_URL = 'http://httpbin.pyfarm.net'¶
- REDIRECT_TARGET = 'http://example.com'¶
- RESOLVED_DNS_NAME = True¶
- HTTP_REQUEST_SUCCESS = True¶
- class pyfarm.agent.testutil.BaseHTTPTestCase(methodName='runTest')[source]¶
Bases: pyfarm.agent.testutil.TestCase
- URI = NotImplemented¶
- CLASS = NotImplemented¶
- CLASS_FACTORY = NotImplemented¶
- CONTENT_TYPES = NotImplemented¶
- class pyfarm.agent.testutil.BaseAPITestCase(methodName='runTest')[source]¶
Bases: pyfarm.agent.testutil.BaseHTTPTestCase
- CONTENT_TYPES = ['application/json']¶