The rbext Tool¶
Review Board ships with a command line tool called rbext that can help you create and test your extension, helping you focus on writing new features for Review Board.
rbext create¶
New in version 3.0.4.
rbext create is used to create an initial extension, complete with packaging. It can optionally set things up to distribute static files and to enable configuration.
At its simplest, you can create an extension with:
$ rbext create --name "My Extension"
A my_extension
package will be created with a basic, functioning extension
and packaging, ready to be modified.
There are several options available to customize the generation of your initial extension:
-
--name
¶
The name you want to give your extension. This should be a human-readable name, not a package name or a class name. Those can be provided separately, or will be generated from this name.
-
--class-name
¶
Sets a specific class name for your extension’s main class. This must be a valid Python class name, and must end with
Extension
.If not set, a name will be generated based on the value passed in
--name
.
-
--package-version
¶
Sets a specific version to use for the package and extension. This will be stored in the
setup.py
in your package. It defaults to “1.0”.
-
--summary
¶
Sets a summary for the package’s
setup.py
,README.rst
and for the extension information.
-
--description
¶
Sets a longer description for the package’s
README.rst
.
Sets the name of the author for the package’s
setup.py
. This can be an individual or the name of an organization/company.
Sets the e-mail address of the author for the package’s
setup.py
. This can be any e-mail address suitable for contacting the developers of the package.
-
--enable-configuration
¶
Whether to generate some files and options for providing a default form for configuring an extension. This will produce
admin_urls.py
andforms.py
files, and setis_configurable = True
on the extension.Learn more about how to customize the configuration of your extension.
-
--enable-static-media
¶
Whether to generate some default static media directories and to enable default rules for CSS/JavaScript static media bundles for your extension.
Learn more about how to work with static media bundles for your extension.
rbext test¶
rbext test is a handy tool for testing your extension, handling all the hard work of setting up an in-memory Review Board environment and database in which to run your test suite.
This is usually invoked like:
$ rbext test -e my_extension.extension.MyExtensionClass
See our guide to testing extensions for more information on how to incorporate a test suite into your extension.
There’s a few special arguments you may want to use:
-
--app
¶
A Django app label to enable in your test environemnt. This can be specified multiple times.
This can be combined with
--extension
and--module
.New in version 4.0.
-
-e
,
--extension
¶
The full Python class path of the extension class to test. This will set up the extension in your environment, loading all relevant Django apps, and locate your tests.
This can be combined with
--app
and--module
.New in version 4.0.
-
-m
,
--module
¶
The name of the top-level module for your extension. This will look for any
tests.py
anywhere within the module.This can be combined with
--app
and--extension
.
-
--pdb
¶
Opens a Python debugger on any failure or error.
New in version 4.0.
-
--tree-root
¶
The path to the root of your extension’s source tree (where
setup.py
lives). This defaults to the current directory.
-
--with-coverage
¶
Whether to include coverage information. This is used to show what lines of your code have been invoked through the test suite, and which lines have not been included in tests. See Showing Test Coverage for examples.
This requires the coverage module to be installed.
New in version 4.0.
-
-x
,
--stop
¶
Stops running tests after the first failure.
New in version 4.0.
A list of modules/classes/functions to test can be included after any options. See Running Unit Tests on how to do this.