Fix unit tests regressions involving SiteConfiguration and HTML output.

Review Request #8328 — Created Aug. 15, 2016 and discarded

Information

Djblets

Reviewers

The Features change broke all unit tests that deal with
`SiteConfiguration`. This happened because `djblets.features`, which
is put into `INSTALLED_APPS`, would import `djblets.features.checkers`,
which imported `SiteConfiguration`.

It's not valid for a module in `INSTALLED_APPS` to directly or indirectly
import a model. While this didn't actually break things in Django 1.6,
it does in 1.7 and higher, due to more strict behavior for model
loading. This import ended up preventing `SiteConfiguration` from being
properly synchronized to the database.

To fix this, the SiteConfiguration import has been moved into the
function that needs it.

There were also two other HTML-related failures.

1) There was a check in the conditions tests that broke due to the
   addition of newlines in generated HTML for one of the widgets we use.
   We now use `assertHTMLEqual()` to perform a more suitable check.

2) We allowed use of an older Pygments releases, but tested against
   newer HTML. We're now requiring a more modern version in
   dev-requirements.txt.

Testing Done:
Unit tests pass against Django 1.6 and 1.8.

Reviewed at https://reviews.reviewboard.org/r/8300/
File dev-requirements.txt need changes on line 9
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/features/checkers.py
        djblets/forms/tests/test_conditions_widget.py
    
    Ignored Files:
        dev-requirements.txt
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/features/checkers.py
        djblets/forms/tests/test_conditions_widget.py
    
    Ignored Files:
        dev-requirements.txt
    
    
  2. 
      
GC
  1. Ship It!

  2. 
      
GC
GC
GC
GC
GC
GC
david
  1. This server is used for real work. Please don't use it for testing, since you're spamming people. If you'd like to try out Review Board, please use http://demo.reviewboard.org/

  2. 
      
david
Review request changed

Status: Discarded

Loading...