Fix running test-backend from any working directory.

This commit is contained in:
Tim Abbott 2016-07-12 10:25:34 -07:00
parent b39e113fef
commit 497142d7b1
1 changed files with 1 additions and 0 deletions

View File

@ -21,6 +21,7 @@ except ImportError as e:
if __name__ == "__main__": if __name__ == "__main__":
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
os.chdir(os.path.dirname(TOOLS_DIR))
sys.path.insert(0, os.path.dirname(TOOLS_DIR)) sys.path.insert(0, os.path.dirname(TOOLS_DIR))
os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings' os.environ['DJANGO_SETTINGS_MODULE'] = 'zproject.test_settings'
# "-u" uses unbuffered IO, which is important when wrapping it in subprocess # "-u" uses unbuffered IO, which is important when wrapping it in subprocess