Add new support for easily testing Review Board extensions.

Review Request #8295 — Created July 19, 2016 and submitted

Information

Review Board
release-3.0.x
3b58b9f...

Reviewers

This introduces a new TestCase class and a command line tool for easily
unit testing Review Board extensions.

The new ExtensionTestCase can be used by extension authors to create
unit tests that make use of an enabled instance of the extension. This
makes use of Djblets's new testing support, and also allows for the
usage of the handy object creation methods we have in Review Board's
main TestCase class.

A new rbext test command is now provided, which makes it easy to run
an extension's test suite. This works similarly to other test runners
like nosetests, but sets up a suitable Review Board environment in which
to run the tests.

To make that work well, and to consolidate code, the main Review Board
test runner now makes use of Djblets's new TestRunner class. This means
that both Review Board and any extensions will be running in the same
kind of environment.

Documentation has been added describing how to make use of all this to
write and run test suites.

Ran the Review Board test suite.

Updated an extension to use ExtensionTestCase, and then ran the
test suite using rbext test. I also tried a variety of other
options (built-in and through nosetests), and tried running
subsets of tests. All worked.

Read through the new docs and verified that the formatting and
linking was all correct.

Description From Last Updated

A "test" snuck into your description.

daviddavid

'six' imported but unused

reviewbotreviewbot

Col: 1 E402 module level import not at top of file

reviewbotreviewbot

Col: 1 W391 blank line at end of file

reviewbotreviewbot

This is a comma splice.

brenniebrennie

"handles"

brenniebrennie

"light"

brenniebrennie

This is sheet

MP mpietryga
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/extensions/testing/__init__.py
        reviewboard/extensions/tests.py
        reviewboard/test.py
        reviewboard/extensions/testing/testcases.py
        reviewboard/cmdline/rbext.py
        setup.py
    
    Ignored Files:
        docs/manual/extending/extensions/testing.rst
        docs/manual/extending/coderef/index.rst
        docs/manual/extending/extensions/index.rst
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/extensions/testing/__init__.py
        reviewboard/extensions/tests.py
        reviewboard/test.py
        reviewboard/extensions/testing/testcases.py
        reviewboard/cmdline/rbext.py
        setup.py
    
    Ignored Files:
        docs/manual/extending/extensions/testing.rst
        docs/manual/extending/coderef/index.rst
        docs/manual/extending/extensions/index.rst
    
    
  2. reviewboard/cmdline/rbext.py (Diff revision 1)
     
     
    Show all issues
     'six' imported but unused
    
  3. reviewboard/cmdline/rbext.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     E402 module level import not at top of file
    
  4. Show all issues
    Col: 1
     W391 blank line at end of file
    
  5. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/extensions/testing/__init__.py
        reviewboard/extensions/tests.py
        reviewboard/test.py
        reviewboard/extensions/testing/testcases.py
        reviewboard/cmdline/rbext.py
        setup.py
    
    Ignored Files:
        docs/manual/extending/extensions/testing.rst
        docs/manual/extending/coderef/index.rst
        docs/manual/extending/extensions/index.rst
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/extensions/testing/__init__.py
        reviewboard/extensions/tests.py
        reviewboard/test.py
        reviewboard/extensions/testing/testcases.py
        reviewboard/cmdline/rbext.py
        setup.py
    
    Ignored Files:
        docs/manual/extending/extensions/testing.rst
        docs/manual/extending/coderef/index.rst
        docs/manual/extending/extensions/index.rst
    
    
  2. 
      
brennie
  1. 
      
  2. reviewboard/cmdline/rbext.py (Diff revision 2)
     
     
    Show all issues

    This is a comma splice.

  3. reviewboard/cmdline/rbext.py (Diff revision 2)
     
     
    Show all issues

    "handles"

  4. reviewboard/test.py (Diff revision 2)
     
     
    Show all issues

    "light"

  5. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/extensions/testing/__init__.py
        reviewboard/extensions/tests.py
        reviewboard/test.py
        reviewboard/extensions/testing/testcases.py
        reviewboard/cmdline/rbext.py
        setup.py
    
    Ignored Files:
        docs/manual/extending/extensions/testing.rst
        docs/manual/extending/coderef/index.rst
        docs/manual/extending/extensions/index.rst
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/extensions/testing/__init__.py
        reviewboard/extensions/tests.py
        reviewboard/test.py
        reviewboard/extensions/testing/testcases.py
        reviewboard/cmdline/rbext.py
        setup.py
    
    Ignored Files:
        docs/manual/extending/extensions/testing.rst
        docs/manual/extending/coderef/index.rst
        docs/manual/extending/extensions/index.rst
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    A "test" snuck into your description.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
MP
  1. 
      
  2. setup.py (Diff revision 3)
     
     
     
     
     
     
     
     
     
     
    Show all issues

    This is sheet

    1. Hey Mateusz,

      This is a production instance of Review Board. Please don't use it for testing. If you'd like to play with a demo instance of Review Board, you can find one here: http://demo.reviewboard.org/dashboard/

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (de85920)