Fix issues with module conflicts when running unit tests.
Review Request #7523 — Created July 14, 2015 and submitted
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 |
reviewbot | |
'from settings_local import *' used; unable to detect undefined names |
reviewbot | |
'PIPELINE_CSS' imported but unused |
reviewbot | |
'PIPELINE_JS' imported but unused |
reviewbot | |
Please make these two string literals be bytes (see my other change). |
david | |
'django_reset' imported but unused |
reviewbot | |
'from settings_local import *' used; unable to detect undefined names |
reviewbot | |
'PIPELINE_CSS' imported but unused |
reviewbot | |
'PIPELINE_JS' imported but unused |
reviewbot |
- Change Summary:
-
Used byte strings for the environment key/value.
- Commit:
-
79595b755ac985a35baa53a523fd77f708eab6aca30ee39578339d7b7a1d4b2401519d9dfaee11c0