• 
      

    Allow @requires_user_profile to decorate classes as well

    Review Request #9950 — Created May 16, 2018 and submitted

    Information

    Djblets
    release-1.0.x
    784b405...

    Reviewers

    Djblets provided @requires_user_profile to ensure that the User
    model has a get_profile method so that unit tests can run across
    Django 1.6 (where User.get_profile exists) and Django 1.7+ (where it
    has been removed).

    This decorator has been updated to also work for classes. When applied
    to a class, it will apply the decorator to all methods in the class that
    begin with test_. In other words, it has the same effect as manually
    applying the decorator to each test method in the class.

    Ran unit tests on Django 1.6.11 and Django 1.8.19.

    Description From Last Updated

    It's not always safe to iterate modify a dictionary during iteration.

    chipx86chipx86
    chipx86
    1. 
        
    2. djblets/testing/decorators.py (Diff revision 1)
       
       
       
       
       
       
      Show all issues

      It's not always safe to iterate modify a dictionary during iteration.

      1. Reasonably convinced it's safe. I thought modification could end up being treated like and add/remove, but I'm not finding evidence of this.

    3. 
        
    david
    1. Ship It!
    2. 
        
    brennie
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-1.0.x (d863ccf)