Fix issues with module conflicts when running unit tests.

Review Request #7523 — Created July 14, 2015 and submitted

Information

Review Board
release-2.0.x
a30ee39...

Reviewers

We recently fixed rbssh so that it would include any enabled extensions
in order to make us of custom SSH backends. This led to an eventual
import of the "site" module (through the extension framework), which
ended up finding our "reviewboard.site" module instead of the global
"site" module. That happened because Python will put the directory
containing the script you're executing into the Python path. In our
case, for manage.py, that ended up being "reviewboard/reviewboard".

There were really two problems here:

1. We really don't want that directory in the Python path, as we don't
   want our Review Board app directories to appear as global modules.

2. We don't actually want extensions to be activated in rbssh if we're
   running unit tests, since custom SSH backends will break the tests.

This change addresses both of these cases. We remove the path right away
in manage.py, and we set an environment variable indicating that we're
running the test suite, which feeds the default for
settings.RUNNING_TEST.

All unit tests pass.

Description From Last Updated

'django_reset' imported but unused

reviewbotreviewbot

'from settings_local import *' used; unable to detect undefined names

reviewbotreviewbot

'PIPELINE_CSS' imported but unused

reviewbotreviewbot

'PIPELINE_JS' imported but unused

reviewbotreviewbot

Please make these two string literals be bytes (see my other change).

daviddavid

'django_reset' imported but unused

reviewbotreviewbot

'from settings_local import *' used; unable to detect undefined names

reviewbotreviewbot

'PIPELINE_CSS' imported but unused

reviewbotreviewbot

'PIPELINE_JS' imported but unused

reviewbotreviewbot
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/manage.py
        reviewboard/settings.py
        reviewboard/test.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/manage.py
        reviewboard/settings.py
        reviewboard/test.py
    
    
  2. reviewboard/settings.py (Diff revision 1)
     
     
    Show all issues
     'django_reset' imported but unused
    
  3. reviewboard/settings.py (Diff revision 1)
     
     
    Show all issues
     'from settings_local import *' used; unable to detect undefined names
    
  4. reviewboard/settings.py (Diff revision 1)
     
     
    Show all issues
     'PIPELINE_CSS' imported but unused
    
  5. reviewboard/settings.py (Diff revision 1)
     
     
    Show all issues
     'PIPELINE_JS' imported but unused
    
  6. 
      
david
  1. 
      
  2. reviewboard/test.py (Diff revision 1)
     
     
    Show all issues

    Please make these two string literals be bytes (see my other change).

  3. 
      
chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/manage.py
        reviewboard/settings.py
        reviewboard/test.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/manage.py
        reviewboard/settings.py
        reviewboard/test.py
    
    
  2. reviewboard/settings.py (Diff revision 2)
     
     
    Show all issues
     'django_reset' imported but unused
    
  3. reviewboard/settings.py (Diff revision 2)
     
     
    Show all issues
     'from settings_local import *' used; unable to detect undefined names
    
  4. reviewboard/settings.py (Diff revision 2)
     
     
    Show all issues
     'PIPELINE_CSS' imported but unused
    
  5. reviewboard/settings.py (Diff revision 2)
     
     
    Show all issues
     'PIPELINE_JS' imported but unused
    
  6. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (e35055b)
Loading...