Part of lp
Module | branding | No module docstring; 1/1 functions documented |
Module | breadcrumbs | Undocumented |
Module | browser | A real, socket connecting browser. |
Module | dbuser | Provides a context manager to run parts of a test as a different dbuser. |
Module | deprecated | Infrastructure for testing LaunchpadFormView subclasses. |
Module | event | Helper class for checking the event notifications. |
Module | factory | Testing infrastructure for the Launchpad application. |
Module | fakemethod | No module docstring; 1/1 classes documented |
Module | faketransaction | Fake transaction manager. |
Module | fixture | Launchpad test fixtures that have no better home. |
Package | gpgkeys | OpenPGP keys used for testing. |
Module | karma | Helper functions/classes to be used when testing the karma framework. |
Package | keyserver | No package docstring; 2/3 modules, 0/1 packages documented |
Module | layers | Layers used by Launchpad tests. |
Module | librarianhelpers | Various helper functions for using the librarian in testing.. |
Module | Useful helper functions used for testing. | |
Module | mail_helpers | Helper functions dealing with emails in tests. |
Module | matchers | No module docstring; 15/20 classes, 1/1 functions documented |
Module | menu | Helpers for testing menus. |
Module | pages | Testing infrastructure for page tests. |
Module | pgsql | Test harness for tests needing a PostgreSQL backend. |
Module | publication | Helpers for testing out publication related code. |
Module | sampledata | Constants that refer to values in sampledata. |
Module | script | Helper functions for running external commands. |
Module | service_usage_helpers | Helper functions dealing with IServiceUsage. |
Module | smtpd | SMTP test helper. |
Package | swift | No package docstring; 2/2 modules, 0/1 packages documented |
Module | systemdocs | Infrastructure for setting up doctests. |
Package | tests | Tests for the lp.testing module. |
Package | utilities | No package docstring; 1/1 modules documented |
Module | views | Functions to help with the testing of views. |
Module | xmlrpc | Tools for testing XML-RPC services. |
Module | yuixhr | Fixture code for YUITest + XHR integration testing. |
Module | _login | No module docstring; 1/2 functions documented |
Module | _webservice | No module docstring; 1/1 functions documented |
From the __init__.py module:
Class | AbstractYUITestCase | No class docstring; 3/4 methods documented |
Class | BrowserTestCase | A TestCase class for browser tests. |
Class | EventRecorder | Intercept and record Zope events. |
Class | ExpectedException | An ExpectedException that provides access to the caught exception. |
Class | FakeAdapterMixin | A testcase mixin that helps register/unregister Zope adapters. |
Class | FakeLaunchpadRequest | No class docstring; 1/1 methods documented |
Class | FakeTime | Provides a controllable implementation of time.time(). |
Class | RequestTimelineCollector | Collect timeline events logged in web requests. |
Class | StormStatementRecorder | A Storm tracer to record all database queries. |
Class | TestCase | Provide Launchpad-specific test facilities. |
Class | TestCaseWithFactory | No class docstring; 5/8 methods, 1/1 static methods documented |
Class | WebServiceTestCase | Test case optimized for testing the web service using launchpadlib. |
Class | YUIUnitTestCase | Undocumented |
Class | ZopeTestInSubProcess | Run tests in a sub-process, respecting Zope idiosyncrasies. |
Function | admin_logged_in | Undocumented |
Function | anonymous_logged_in | Make a context manager for running with the anonymous log in. |
Function | api_url | Find the web service URL of a data model object. |
Function | celebrity_logged_in | Make a context manager for running logged in as a celebrity. |
Function | launchpadlib_credentials_for | Create launchpadlib credentials for the given person. |
Function | launchpadlib_for | Create a Launchpad object for the given person. |
Function | login | Simulates a login, using the specified email. |
Function | login_admin | Log in as an admin. |
Function | login_as | Login as a person or a team. |
Function | login_celebrity | Login as a celebrity. |
Function | login_person | Login the person with their preferred email. |
Function | login_team | Login as a member of 'team'. |
Function | logout | Tear down after login(...), ending the current interaction. |
Function | oauth_access_token_for | Find or create an OAuth access token for the given person. |
Function | person_logged_in | Make a context manager for running logged in as 'person'. |
Function | run_with_login | Run 'function' with 'person' logged in. |
Function | with_celebrity_logged_in | Decorate a function so that it's run with a celebrity logged in. |
Function | with_person_logged_in | Undocumented |
Function | build_yui_unittest_suite | Undocumented |
Function | clean_up_reactor | Undocumented |
Function | extract_lp_cache | Undocumented |
Function | feature_flags | Provide a context in which feature flags work. |
Function | map_branch_contents | Return all files in branch at branch_url . |
Function | monkey_patch | In the ContextManager scope, monkey-patch values. |
Function | nonblocking_readline | Non-blocking readline. |
Function | normalize_whitespace | Replace all sequences of whitespace with a single space. |
Function | record_statements | Run the function and record the sql statements that are executed. |
Function | record_two_runs | A helper that returns the two storm statement recorders |
Function | reset_logging | Reset the logging system back to defaults |
Function | run_process | Run the given command as a subprocess. |
Function | run_script | Run the given command line as a subprocess. |
Function | run_with_storm_debug | A helper function to run a function with storm debug tracing on. |
Function | set_feature_flag | Set a feature flag to the specified value. |
Function | time_counter | A generator for yielding datetime values. |
Function | unlink_source_packages | Remove all links between the product and source packages. |
Function | validate_mock_class | Validate method signatures in mock classes derived from real classes. |
Function | verifyObject | A specialized verifyObject which removes the security proxy of the |
Function | ws_object | Convert an object into its webservice version. |
Function | _harvest_yui_test_files | Undocumented |
If the lp.testing.ANONYMOUS constant is supplied as the email, you'll be logged in as the anonymous user.
You can optionally pass in a participation to be used. If no participation is given, a LaunchpadTestRequest is used.
If the participation provides IPublicationRequest, it must implement setPrincipal(), otherwise it must allow setting its principal attribute.
Parameters | person_or_team | A person, a team, ANONYMOUS or None. None and ANONYMOUS are equivalent, and will log the person in as the anonymous user. |
Note that this is done automatically in LaunchpadFunctionalTestCase's tearDown method so you generally won't need to call this.
Parameters | person | A person, an account, a team or ANONYMOUS. If a team, will log in as an arbitrary member of that team. |
This makes it easy to load up the factory object you just created in launchpadlib.
Parameters | Which web service version to use. | |
Returns | A relative URL suitable for passing into Launchpad.load(). |
Parameters | consumer_name | An OAuth consumer name. |
person | A person (or the name of a person) for whom to create or find credentials. | |
permission | An OAuthPermission (or its token) designating the level of permission the credentials should have. | |
context | The OAuth context for the credentials. | |
Returns | A launchpadlib Credentials object. |
Parameters | consumer_name | An OAuth consumer name. |
person | A person (or the name of a person) for whom to create or find credentials. | |
permission | An OAuthPermission (or its token) designating the level of permission the credentials should have. | |
context | The OAuth context for the credentials. | |
version | The version of the web service to access. | |
service_root | The root URL of the web service to access. | |
Returns | A launchpadlib Launchpad object. |
Find or create an OAuth access token for the given person. :param consumer_name: An OAuth consumer name. :param person: A person (or the name of a person) for whom to create or find credentials. :param permission: An OAuthPermission (or its token) designating the level of permission the credentials should have. :param context: The OAuth context for the credentials (or a string designating same). :return: A tuple of an OAuthAccessToken object and its secret.
Currently, defaults means 'the way the Z3 testrunner sets it up' plus customizations made in lp_sitecustomize
Returns | a tuple containing the return value of the function, and a list of sql statements. |
If {login_method} is not None, it is called before each batch of {item_creator} calls.
If {record_request} is True, RequestTimelineCollector
is used to get
the query counts, so {tested_method} should make a web request.
Otherwise, StormStatementRecorder
is used to get the query count.
Returns | a tuple containing the two recorders obtained by the successive runs. |
A generator for yielding datetime values.
Each time the generator yields a value, the origin is incremented by the delta.
>>> now = time_counter(datetime(2007, 12, 1), timedelta(days=1)) >>> now.next() datetime.datetime(2007, 12, 1, 0, 0) >>> now.next() datetime.datetime(2007, 12, 2, 0, 0) >>> now.next() datetime.datetime(2007, 12, 3, 0, 0)
Parameters | cmd_line | A command line suitable for passing to
subprocess.Popen . |
env | An optional environment dict. If none is given, the script will get a copy of your present environment. Either way, PYTHONPATH will be removed from it because it will break the script. | |
Returns | A 3-tuple of stdout, stderr, and the process' return code. |
This differs from run_script
in that it does not execute via a shell and
it explicitly connects stdin to /dev/null so that processes will not be
able to hang, waiting for user input.
Parameters | cmd_line | A command suitable for passing to subprocess.Popen . |
env | An optional environment dict. If none is given, the script will get a copy of your present environment. Either way, PYTHONPATH will be removed from it because it will break the script. | |
Returns | A 3-tuple of stdout, stderr, and the process' return code. |
branch_url
.Parameters | branch_url | the URL for an accessible branch. |
Returns | a dict mapping file paths to file contents. Only regular files are included. |
In order to access the flag, use the feature_flags context manager or set the feature controller in some other way. :param name: The name of the flag. :param value: The value of the flag. :param scope: The scope in which the specified value applies.
Validate method signatures in mock classes derived from real classes.
We often use mock classes in tests which are derived from real classes.
This function ensures that methods redefined in the mock class have the same signature as the corresponding methods of the base class.
>>> class A: ... ... def method_one(self, a): ... pass
>>> >>> class B(A): ... def method_one(self, a): ... pass >>> validate_mock_class(B)
If a class derived from A defines method_one with a different signature, we get an AssertionError.
>>> class C(A): ... def method_one(self, a, b): ... pass >>> validate_mock_class(C) Traceback (most recent call last): ... AssertionError: Different method signature for method_one:...
Even a parameter name must not be modified.
>>> class D(A): ... def method_one(self, b): ... pass >>> validate_mock_class(D) Traceback (most recent call last): ... AssertionError: Different method signature for method_one:...
If validate_mock_class() for anything but a class, we get an AssertionError.
>>> validate_mock_class('a string') Traceback (most recent call last): ... AssertionError: validate_mock_class() must be called for a class
Parameters | launchpad | The Launchpad instance to convert from. |
obj | The object to convert. | |
Returns | A launchpadlib Entry object. |
The context may be anything that supports setattr. Packages, modules, objects, etc. The kwargs are the name/value pairs for the values to set.
A product cannot be deactivated if it is linked to source packages.