Add an ExtensionTestCase to allow testing of the models of Review Board extensions

Review Request #6821 — Created Jan. 22, 2015 and discarded

Information

Review Board
master

Reviewers

The ExtensionTestCase class is a special test case base class for
Review Board extensions. It exposes the models of the extension via
the models attribute on instances of the sub-class.

To run tests on the extension, execute
./reviewboard/manage.py test -- extension.tests
where extensions.test is the module containing the tests.

Created an extension with a model. Subclassed ExtensionTestCase
and created test methods that passed on that subclass.

Description From Last Updated

The general import statements go before the from ... imports.

chipx86chipx86

Mixins should go before the parent classes.

chipx86chipx86

Missing period at the end.

chipx86chipx86

Django's ImproperlyConfigured exception would be a good one to use here.

chipx86chipx86

There's no guarantee that this lives in a module named "extension," I don't believe. Can we have the consumer just …

chipx86chipx86

We don't always want this enabled up-front. Often, you want to test what happens when enabling an extension, and need …

chipx86chipx86

These should also call the parent functions.

chipx86chipx86

Col: 9 E303 too many blank lines (2)

reviewbotreviewbot
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/testing/extensions.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/testing/extensions.py
    
    
  2. 
      
chipx86
  1. Awesome to have real progress on this!

    It doesn't look like anything in here is RB-specific, aside from fetching the ExtensionManager. How about moving most of this into Djblets, and then having this subclass just provide the extension manager?

  2. reviewboard/testing/extensions.py (Diff revision 1)
     
     
     
     

    The general import statements go before the from ... imports.

  3. reviewboard/testing/extensions.py (Diff revision 1)
     
     

    Mixins should go before the parent classes.

  4. reviewboard/testing/extensions.py (Diff revision 1)
     
     

    Missing period at the end.

  5. reviewboard/testing/extensions.py (Diff revision 1)
     
     

    Django's ImproperlyConfigured exception would be a good one to use here.

  6. reviewboard/testing/extensions.py (Diff revision 1)
     
     
     

    There's no guarantee that this lives in a module named "extension," I don't believe. Can we have the consumer just supply the extension class instance, and compute it from that, like:

    extension_id = '%s.%s' % (cls.extension.__module__, cls.extension.__name__)
    
  7. reviewboard/testing/extensions.py (Diff revision 1)
     
     

    We don't always want this enabled up-front. Often, you want to test what happens when enabling an extension, and need to set things up up-front. I'd leave this out and just let the subclass decide whether to call this in setUp or in a test function.

  8. reviewboard/testing/extensions.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     

    These should also call the parent functions.

  9. 
      
brennie
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/testing/extensions.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/testing/extensions.py
    
    
  2. reviewboard/testing/extensions.py (Diff revision 2)
     
     
    Col: 9
     E303 too many blank lines (2)
    
  3. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/testing/extensions.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/testing/extensions.py
    
    
  2. 
      
brennie
mike_conley
  1. Was this going to get moved to Djblets?

  2. 
      
brennie
Review request changed

Status: Discarded

Change Summary:

Student is working on this project.

Loading...