-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
windows compatiblity changes for setup scripts, movement of bootstrap…
…per to its own file
- Loading branch information
Showing
8 changed files
with
38 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env python | ||
__author__ = 'chris' | ||
from djangui.backend import command_line | ||
|
||
if __name__ == "__main__": | ||
command_line.bootstrap() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,40 @@ | ||
__author__ = 'chris' | ||
from unittest import TestCase | ||
import subprocess | ||
import os | ||
import subprocess | ||
import shutil | ||
import sys | ||
|
||
BASE_DIR = os.path.split(__file__)[0] | ||
DJANGUI_SCRIPT_PATH = os.path.join(BASE_DIR, '..', 'scripts', 'djanguify.py') | ||
DJANGUI_SCRIPT_PATH = os.path.join(BASE_DIR, '..', 'scripts', 'djanguify') | ||
DJANGUI_TEST_PROJECT_NAME = 'djangui_project' | ||
DJANGUI_TEST_PROJECT_PATH = os.path.join(BASE_DIR, DJANGUI_TEST_PROJECT_NAME) | ||
DJANGUI_TEST_PROJECT_MANAGE = os.path.join(DJANGUI_TEST_PROJECT_PATH, 'manage.py') | ||
PYTHON_INTERPRETTER = 'python' | ||
PYTHON_INTERPRETTER = sys.executable | ||
|
||
env = os.environ | ||
env['DJANGO_SETTINGS_MODULE'] = '{}.settings'.format(DJANGUI_TEST_PROJECT_NAME) | ||
env['TESTING'] = 'True' | ||
|
||
class TestProject(TestCase): | ||
def setUp(self): | ||
os.chdir(BASE_DIR) | ||
# if old stuff exists, remove it | ||
if os.path.exists(DJANGUI_TEST_PROJECT_PATH): | ||
shutil.rmtree(DJANGUI_TEST_PROJECT_PATH) | ||
|
||
def tearDown(self): | ||
os.chdir(BASE_DIR) | ||
if os.path.exists(DJANGUI_TEST_PROJECT_PATH): | ||
shutil.rmtree(DJANGUI_TEST_PROJECT_PATH) | ||
|
||
def test_bootstrap(self): | ||
proc = subprocess.Popen([PYTHON_INTERPRETTER, DJANGUI_SCRIPT_PATH, '-p', DJANGUI_TEST_PROJECT_NAME], | ||
cwd=BASE_DIR, env=env, stderr=subprocess.PIPE) | ||
stdout, stderr = proc.communicate() | ||
self.assertEqual(proc.returncode, 0, msg=stderr) | ||
from djangui.backend import command_line | ||
sys.argv = [DJANGUI_SCRIPT_PATH, '-p', DJANGUI_TEST_PROJECT_NAME] | ||
ret = command_line.bootstrap(env=env, cwd=BASE_DIR) | ||
self.assertIsNone(ret) | ||
# test our script is executable from the command line, it will fail with return code of 1 since | ||
# the project already exists | ||
proc = subprocess.Popen([PYTHON_INTERPRETTER, DJANGUI_SCRIPT_PATH, '-p', DJANGUI_TEST_PROJECT_NAME]) | ||
stdout, stderr = proc.communicate() | ||
self.assertEqual(proc.returncode, 1, stderr) |