Adding Extension tests to Djblets

Review Request #1687 — Created June 27, 2010 and submitted

Information

Djblets
extensions

Reviewers

This is the first set of tests for the extension framework classes.  There'll be more, don't worry.

I'm using Mock here (http://pypi.python.org/pypi/mock/0.6.0), so you'll need to install it with easy_install to run
these tests.

I've also removed the manager argument in the ExtensionInfo constructor, since the manager is assigned to an Extension automatically by ExtensionManager (extensions/base.py line 333).

Open to all suggestions / criticisms / feedback.

Note:  not sure why it's not included in this diff, but I've also added a test/ folder to extensions, with admin_urls.py and __init__.py.  This lets ExtensionTest pass.
All Djblets tests pass.
mike_conley
chipx86
  1. 
      
  2. djblets/extensions/tests.py (Diff revision 1)
     
     
     
     
     
     
    This should be one big group. It's  the "third party modules" section, and should also be in alphabetical order.
  3. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Dictionaries declared inline with multiple keys should have one key per row, with no keys on the row defining the dict.
  4. djblets/extensions/tests.py (Diff revision 1)
     
     
    I'm trying to move us away from camelCase for the unit test function names. Can you switch these to using underscores?
  5. djblets/extensions/tests.py (Diff revision 1)
     
     
    It'd be nice to put something in these to indicate that it's the Extension's Settings constructor, as it'll otherwise be less clear when looking at a bunch of unit tests from all over the codebase.
  6. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Blank line between these.
  7. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Same here about the dict. Also, anywhere else this happens to be defined.
  8. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Here too.
    
    Any where where there's a comment immediately followed by code. There should always be a blank line between them.
  9. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Parameters should align.
  10. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Here too.
  11. djblets/extensions/tests.py (Diff revision 1)
     
     
    No need for pass.
  12. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Blank line here.
  13. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Blank line here.
  14. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    Blank line here.
  15. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    And here.
    
    Any time there's a block (if statement, for loop, etc.) immediately following code, there should be a blank line between the code and the block.
  16. djblets/extensions/tests.py (Diff revision 1)
     
     
    Classes must start with an uppercase letter.
  17. djblets/extensions/tests.py (Diff revision 1)
     
     
     
    I'd prefer something like:
    
    self.blahblah = Mock(
        return_value=[
            '%s: %s' % (key, value)
            for key, value in blahblah
        ])
  18. 
      
mike_conley
david
  1. 
      
  2. djblets/extensions/tests.py (Diff revision 2)
     
     
    Can you add a docstring for this?
  3. 
      
mike_conley
Review request changed
Change Summary:
Thanks for the review, David.  Docstring added.
mike_conley
  1. Patch available here: http://github.com/mikeconley/djblets/commits/rr1687_first_round_extension_tests
  2. 
      
chipx86
  1. Committed to extensions as a195f36
  2.