Fix issues with module conflicts when running unit tests.

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

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.